Commit 9b038d9a authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen
Browse files

add content-type header for CreateSMContext Response

parent d5b39aa1
......@@ -392,17 +392,21 @@ void smf_http2_server::create_sm_contexts_handler(
Logger::smf_api_server().debug("Got result for promise ID %d", promise_id);
nlohmann::json json_data = { };
sm_context_response.get_json_data(json_data);
//Add header
header_map h;
//Location header
if (sm_context_response.get_smf_context_uri().size() > 0) {
Logger::smf_api_server().debug(
"Add location header %s",
sm_context_response.get_smf_context_uri().c_str());
header_map h;
h.emplace("location", header_value {
sm_context_response.get_smf_context_uri().c_str() });
response.write_head(sm_context_response.get_http_code(), h);
} else {
response.write_head(sm_context_response.get_http_code());
}
//content-type header
h.emplace("content-type", header_value {"application/json"});
response.write_head(sm_context_response.get_http_code(), h);
response.end(json_data.dump().c_str());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment