Skip to main content

json_response

Function json_response 

Source
pub fn json_response(status: StatusCode, body: &Value) -> HttpResponse
Expand description

A JSON response, which is what the short spelling of a scripted answer builds: body rendered into the body and content-type: application/json.

Public so that “the same answer, plus a header” does not start by rebuilding this — take one, insert the header, and queue it with Recorder::answering_with or Recorder::answering_route_with.