Commit 0c968569 authored by Raphael Defosseux's avatar Raphael Defosseux

Merge branch 'fix_http_header' into 'develop'

Fix http header

See merge request oai/cn5g/oai-cn5g-smf!183
parents 1df612c0 e0d10859
...@@ -164,8 +164,8 @@ smf_sbi::smf_sbi() { ...@@ -164,8 +164,8 @@ smf_sbi::smf_sbi() {
handles = {}; handles = {};
headers = nullptr; headers = nullptr;
headers = curl_slist_append(headers, "Accept: application/json"); headers = curl_slist_append(headers, "Accept: application/json");
headers = curl_slist_append(headers, "Charsets: utf-8");
headers = curl_slist_append(headers, "Content-Type: application/json"); headers = curl_slist_append(headers, "Content-Type: application/json");
headers = curl_slist_append(headers, "charsets: utf-8");
if ((code < 0) or (curl_multi == nullptr) or (headers == nullptr)) { if ((code < 0) or (curl_multi == nullptr) or (headers == nullptr)) {
Logger::smf_sbi().error("Cannot initialize Curl Multi Interface"); Logger::smf_sbi().error("Cannot initialize Curl Multi Interface");
...@@ -1092,10 +1092,16 @@ bool smf_sbi::curl_create_handle( ...@@ -1092,10 +1092,16 @@ bool smf_sbi::curl_create_handle(
// Create handle for a curl request // Create handle for a curl request
CURL* curl = curl_easy_init(); CURL* curl = curl_easy_init();
headers = nullptr;
headers = curl_slist_append(headers, "Accept: application/json");
headers = curl_slist_append(headers, "Charsets: utf-8");
if (is_multipart) { if (is_multipart) {
std::string content_type = "content-type: multipart/related; boundary=" + std::string content_type = "Content-type: multipart/related; boundary=" +
std::string(CURL_MIME_BOUNDARY); std::string(CURL_MIME_BOUNDARY);
headers = curl_slist_append(headers, content_type.c_str()); headers = curl_slist_append(headers, content_type.c_str());
} else {
headers = curl_slist_append(headers, "Content-Type: application/json");
} }
if ((curl == nullptr) or (headers == nullptr)) { if ((curl == nullptr) or (headers == nullptr)) {
...@@ -1153,6 +1159,11 @@ bool smf_sbi::curl_create_handle( ...@@ -1153,6 +1159,11 @@ bool smf_sbi::curl_create_handle(
// Create handle for a curl request // Create handle for a curl request
CURL* curl = curl_easy_init(); CURL* curl = curl_easy_init();
headers = nullptr;
headers = curl_slist_append(headers, "Accept: application/json");
headers = curl_slist_append(headers, "Charsets: utf-8");
headers = curl_slist_append(headers, "Content-Type: application/json");
if ((curl == nullptr) or (headers == nullptr)) { if ((curl == nullptr) or (headers == nullptr)) {
Logger::smf_sbi().error("Cannot initialize a new Curl Handle"); Logger::smf_sbi().error("Cannot initialize a new Curl Handle");
return false; return false;
...@@ -1212,6 +1223,11 @@ bool smf_sbi::curl_create_handle( ...@@ -1212,6 +1223,11 @@ bool smf_sbi::curl_create_handle(
// Create handle for a curl request // Create handle for a curl request
CURL* curl = curl_easy_init(); CURL* curl = curl_easy_init();
headers = nullptr;
headers = curl_slist_append(headers, "Accept: application/json");
headers = curl_slist_append(headers, "Charsets: utf-8");
headers = curl_slist_append(headers, "Content-Type: application/json");
if ((curl == nullptr) or (headers == nullptr)) { if ((curl == nullptr) or (headers == nullptr)) {
Logger::smf_sbi().error("Cannot initialize a new Curl Handle"); Logger::smf_sbi().error("Cannot initialize a new Curl Handle");
return false; return false;
...@@ -1269,6 +1285,11 @@ bool smf_sbi::curl_create_handle( ...@@ -1269,6 +1285,11 @@ bool smf_sbi::curl_create_handle(
// Create handle for a curl request // Create handle for a curl request
CURL* curl = curl_easy_init(); CURL* curl = curl_easy_init();
headers = nullptr;
headers = curl_slist_append(headers, "Accept: application/json");
headers = curl_slist_append(headers, "Charsets: utf-8");
headers = curl_slist_append(headers, "Content-Type: application/json");
if ((curl == nullptr) or (headers == nullptr)) { if ((curl == nullptr) or (headers == nullptr)) {
Logger::smf_sbi().error("Cannot initialize a new Curl Handle"); Logger::smf_sbi().error("Cannot initialize a new Curl Handle");
return false; return false;
......
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