fix(engine): fix unit test

This commit is contained in:
Flc゛ 2024-03-11 23:16:04 +08:00
parent ab8042e9e5
commit f62648ab43

View File

@ -24,10 +24,11 @@ import (
"time"
"github.com/gin-contrib/sse"
"github.com/gin-gonic/gin/binding"
testdata "github.com/gin-gonic/gin/testdata/protoexample"
"github.com/stretchr/testify/assert"
"google.golang.org/protobuf/proto"
"github.com/gin-gonic/gin/binding"
testdata "github.com/gin-gonic/gin/testdata/protoexample"
)
var _ context.Context = (*Context)(nil)
@ -1044,7 +1045,7 @@ func TestContextRenderAndEscapeAttachment(t *testing.T) {
c.FileAttachment("./gin.go", maliciousFilename)
assert.Equal(t, 200, w.Code)
assert.Contains(t, w.Body.String(), "func New() *Engine {")
assert.Contains(t, w.Body.String(), "func New(opts ...OptionFunc) *Engine {")
assert.Equal(t, fmt.Sprintf("attachment; filename=\"%s\"", actualEscapedResponseFilename), w.Header().Get("Content-Disposition"))
}