MCPcopy
hub / github.com/monasticacademy/httptap / decodeContent

Function decodeContent

http.go:304–318  ·  view source on GitHub ↗
(r io.Reader, encodings []string)

Source from the content-addressed store, hash-verified

302}
303
304func decodeContent(r io.Reader, encodings []string) ([]byte, error) {
305 var err error
306 for i := len(encodings) - 1; i >= 0; i-- {
307 switch strings.ToLower(encodings[i]) {
308 case "gzip":
309 r, err = gzip.NewReader(r)
310 if err != nil {
311 return nil, fmt.Errorf("error gzip-decoding: %w", err)
312 }
313 default:
314 return nil, fmt.Errorf("unsupported content encoding: %q", encodings[i])
315 }
316 }
317 return io.ReadAll(r)
318}

Callers 1

proxyHTTPSchemeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected