* Stream a JSON-encoded body to the client. * * This function sets the Content-Type header to "application/json", starts the streaming of the response, * and encodes the given value as JSON to the client. If pretty-print is requested, the JSON output will be * formatted accordingly. It is assumed that the response status code and other necessary headers have already * been set. * * @param r
| 67 | * @param yc The yield context to use for asynchronous operations. |
| 68 | */ |
| 69 | void HttpUtility::SendJsonBody(HttpApiResponse& response, const Dictionary::Ptr& params, const Value& val, boost::asio::yield_context& yc) |
| 70 | { |
| 71 | namespace http = boost::beast::http; |
| 72 | |
| 73 | response.set(http::field::content_type, "application/json"); |
| 74 | response.StartStreaming(false); |
| 75 | response.GetJsonEncoder(params && GetLastParameter(params, "pretty")).Encode(val, &yc); |
| 76 | } |
| 77 | |
| 78 | void HttpUtility::SendJsonBody(HttpApiResponse& response, const Dictionary::Ptr& params, const Value& val) |
| 79 | { |
nothing calls this directly
no test coverage detected