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

Method writeRawJSONStatus

rest/handler.go:1572–1580  ·  view source on GitHub ↗

writeRawJSONStatus writes the given bytes as a JSON response. If status is nonzero, the header will be written with that status.

(status int, b []byte)

Source from the content-addressed store, hash-verified

1570// writeRawJSONStatus writes the given bytes as a JSON response.
1571// If status is nonzero, the header will be written with that status.
1572func (h *handler) writeRawJSONStatus(status int, b []byte) {
1573 if !h.requestAccepts("application/json") {
1574 base.WarnfCtx(h.ctx(), "Client won't accept JSON, only %s", h.rq.Header.Get("Accept"))
1575 h.writeStatus(http.StatusNotAcceptable, "only application/json available")
1576 return
1577 }
1578
1579 h.writeRawJSONWithoutClientVerification(status, b)
1580}
1581
1582// writeRawJSON writes the given bytes as a plaintext response with a 200 OK status.
1583func (h *handler) writeText(value []byte) {

Callers 12

handleEFCMethod · 0.95
handleSGCollectStatusMethod · 0.95
handleSGCollectCancelMethod · 0.95
handleSGCollectMethod · 0.95
writeRawJSONMethod · 0.95
handlePutAttachmentMethod · 0.95
handlePutDocMethod · 0.95
handlePostDocMethod · 0.95
handleDeleteDocMethod · 0.95
handlePutLocalDocMethod · 0.95

Calls 6

requestAcceptsMethod · 0.95
ctxMethod · 0.95
writeStatusMethod · 0.95
WarnfCtxFunction · 0.92
GetMethod · 0.45

Tested by

no test coverage detected