MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / readMultiPartBody

Function readMultiPartBody

rest/doc_api_test.go:321–337  ·  view source on GitHub ↗

readMultiPartBody reads a multipart response body and returns the parts as strings

(t *testing.T, response *TestResponse)

Source from the content-addressed store, hash-verified

319
320// readMultiPartBody reads a multipart response body and returns the parts as strings
321func readMultiPartBody(t *testing.T, response *TestResponse) []string {
322 _, params, err := mime.ParseMediaType(response.Header().Get("Content-Type"))
323 require.NoError(t, err)
324 mr := multipart.NewReader(response.Body, params["boundary"])
325 var output []string
326 for {
327 p, err := mr.NextPart()
328 if err == io.EOF {
329 break
330 }
331 require.NoError(t, err)
332 bodyBytes, err := io.ReadAll(p)
333 require.NoError(t, err)
334 output = append(output, string(bodyBytes))
335 }
336 return output
337}
338
339func TestCVUnescapedRevQueryParam(t *testing.T) {
340 tests := []struct {

Callers 2

TestGetDocWithCVFunction · 0.85
TestBulkGetWithCVFunction · 0.85

Calls 2

HeaderMethod · 0.80
GetMethod · 0.45

Tested by

no test coverage detected