MCPcopy Index your code
hub / github.com/ContentSquare/chproxy / getFullQueryFromBody

Function getFullQueryFromBody

utils.go:153–175  ·  view source on GitHub ↗
(req *http.Request)

Source from the content-addressed store, hash-verified

151}
152
153func getFullQueryFromBody(req *http.Request) ([]byte, error) {
154 if req.Body == nil {
155 return nil, nil
156 }
157
158 data, err := io.ReadAll(req.Body)
159 if err != nil {
160 return nil, err
161 }
162 // restore body for further reading
163 req.Body = io.NopCloser(bytes.NewBuffer(data))
164 u := getDecompressor(req)
165 if u == nil {
166 return data, nil
167 }
168 br := bytes.NewReader(data)
169 b, err := u.decompress(br)
170 if err != nil {
171 return nil, fmt.Errorf("cannot uncompress query: %w", err)
172 }
173
174 return b, nil
175}
176
177var cachableStatements = []string{"SELECT", "WITH"}
178

Callers 1

getFullQueryFunction · 0.85

Calls 2

getDecompressorFunction · 0.85
decompressMethod · 0.65

Tested by

no test coverage detected