toJSON #
Available since 2.11.0
Serializes the response into the object Kuzzle sends back to the protocol.
With the standard format, content is the response payload. It only holds the headers set by the application (through configure), and never the Set-Cookie header.
{
content: {
action, collection, controller, deprecations, error, headers,
index, node, requestId, result, status, volatile,
},
headers,
raw: false,
requestId,
status,
}With the raw format, content is the result itself:
{
content: result,
headers,
raw: true,
requestId,
status,
}Arguments #
toJSON (): JSONObjectExample #
const { status, content } = request.response.toJSON();