Skip to content
Snippets Groups Projects
Commit b6f3953f authored by Rohan's avatar Rohan
Browse files

HTTP2 fix for json response data formatting

parent 1c232297
No related branches found
No related tags found
1 merge request!37HTTP2 fix for json response data formatting
Pipeline #35005 passed
...@@ -337,7 +337,14 @@ void nrf_http2_server::get_nf_instances_handler( ...@@ -337,7 +337,14 @@ void nrf_http2_server::get_nf_instances_handler(
to_json(json_data, problem_details); to_json(json_data, problem_details);
content_type = "application/problem+json"; content_type = "application/problem+json";
} else { } else {
profile.get()->to_json(json_data); // convert URIs to Json
json_data["_links"]["item"] = nlohmann::json::array();
json_data["_links"]["self"] = "";
for (auto u : uris) {
nlohmann::json json_item = {};
json_item["href"] = u;
json_data["_links"]["item"].push_back(json_item);
}
} }
header_map h; header_map h;
...@@ -346,7 +353,7 @@ void nrf_http2_server::get_nf_instances_handler( ...@@ -346,7 +353,7 @@ void nrf_http2_server::get_nf_instances_handler(
nrf_cfg.sbi_api_version + "/nf-instances/"}); nrf_cfg.sbi_api_version + "/nf-instances/"});
h.emplace("content-type", header_value{content_type}); h.emplace("content-type", header_value{content_type});
response.write_head(http_code, h); response.write_head(http_code, h);
response.end(); response.end(json_data.dump().c_str());
} }
void nrf_http2_server::update_instance_handler( void nrf_http2_server::update_instance_handler(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment