MCPcopy
hub / github.com/gin-gonic/gin / assertMultipartFileHeader

Function assertMultipartFileHeader

binding/multipart_form_mapping_test.go:126–139  ·  view source on GitHub ↗
(t *testing.T, fh *multipart.FileHeader, file testFile)

Source from the content-addressed store, hash-verified

124}
125
126func assertMultipartFileHeader(t *testing.T, fh *multipart.FileHeader, file testFile) {
127 assert.Equal(t, file.Filename, fh.Filename)
128 assert.Equal(t, int64(len(file.Content)), fh.Size)
129
130 fl, err := fh.Open()
131 require.NoError(t, err)
132
133 body, err := io.ReadAll(fl)
134 require.NoError(t, err)
135 assert.Equal(t, string(file.Content), string(body))
136
137 err = fl.Close()
138 require.NoError(t, err)
139}

Calls 2

CloseMethod · 0.80
OpenMethod · 0.45

Tested by

no test coverage detected