mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-17 05:42:09 +08:00
handle unhandled error in context_1.17_test.go
This commit is contained in:
parent
79c9c46dea
commit
184f2f8ff0
@ -30,7 +30,12 @@ func (i interceptedWriter) WriteHeader(code int) {
|
|||||||
func TestContextFormFileFailed17(t *testing.T) {
|
func TestContextFormFileFailed17(t *testing.T) {
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
mw := multipart.NewWriter(buf)
|
mw := multipart.NewWriter(buf)
|
||||||
mw.Close()
|
defer func(mw *multipart.Writer) {
|
||||||
|
err := mw.Close()
|
||||||
|
if err != nil {
|
||||||
|
assert.Error(t, err)
|
||||||
|
}
|
||||||
|
}(mw)
|
||||||
c, _ := CreateTestContext(httptest.NewRecorder())
|
c, _ := CreateTestContext(httptest.NewRecorder())
|
||||||
c.Request, _ = http.NewRequest("POST", "/", nil)
|
c.Request, _ = http.NewRequest("POST", "/", nil)
|
||||||
c.Request.Header.Set("Content-Type", mw.FormDataContentType())
|
c.Request.Header.Set("Content-Type", mw.FormDataContentType())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user