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

Method readJavascript

rest/handler.go:1369–1383  ·  view source on GitHub ↗

readJavascript reads a javascript function from a request body.

()

Source from the content-addressed store, hash-verified

1367
1368// readJavascript reads a javascript function from a request body.
1369func (h *handler) readJavascript() (string, error) {
1370 // Performs the Content-Type validation and Content-Encoding check.
1371 input, err := processContentEncoding(h.rq.Header, h.requestBody, "application/javascript")
1372 if err != nil {
1373 return "", err
1374 }
1375
1376 defer func() { _ = input.Close() }()
1377 jsBytes, err := io.ReadAll(input)
1378 if err != nil {
1379 return "", err
1380 }
1381
1382 return string(jsBytes), nil
1383}
1384
1385// readSanitizeJSONInto reads and sanitizes a JSON request body and returns raw bytes and DbConfig.
1386// Expands environment variables (if any) referenced in the config.

Calls 2

processContentEncodingFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected