Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
oai
cn5g
oai-cn5g-smf
Commits
f750f1ab
Commit
f750f1ab
authored
Apr 23, 2021
by
Tien-Thinh Nguyen
Browse files
Merge branch 'fix_PDU_session_establishment_reject' into 'develop'
Fix pdu session establishment reject See merge request
!59
parents
0bc2e054
2f8109e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/api-server/impl/SMContextsCollectionApiImpl.cpp
View file @
f750f1ab
...
...
@@ -40,6 +40,7 @@
#include <nghttp2/asio_http2_server.h>
#include "smf_config.hpp"
#include "3gpp_conversions.hpp"
#include "mime_parser.hpp"
extern
smf
::
smf_config
smf_cfg
;
...
...
@@ -102,21 +103,35 @@ void SMContextsCollectionApiImpl::post_sm_contexts(
Logger
::
smf_api_server
().
debug
(
"Got result for promise ID %d"
,
promise_id
);
nlohmann
::
json
json_data
=
{};
mime_parser
parser
=
{};
std
::
string
json_format
=
{};
std
::
string
body
=
{};
response
.
headers
().
add
<
Pistache
::
Http
::
Header
::
Location
>
(
sm_context_response
.
get_smf_context_uri
());
// Location header
sm_context_response
.
get_json_data
(
json_data
);
std
::
string
json_format
;
sm_context_response
.
get_json_format
(
json_format
);
if
(
!
json_data
.
empty
())
{
if
(
sm_context_response
.
n1_sm_msg_is_set
())
{
// add N1 container if
// available
parser
.
create_multipart_related_content
(
body
,
json_data
.
dump
(),
CURL_MIME_BOUNDARY
,
sm_context_response
.
get_n1_sm_message
(),
multipart_related_content_part_e
::
NAS
,
json_format
);
response
.
headers
().
add
<
Pistache
::
Http
::
Header
::
ContentType
>
(
Pistache
::
Http
::
Mime
::
MediaType
(
"multipart/related; boundary="
+
std
::
string
(
CURL_MIME_BOUNDARY
)));
}
else
if
(
!
json_data
.
empty
())
{
// if not, include json data if available
response
.
headers
().
add
<
Pistache
::
Http
::
Header
::
Location
>
(
sm_context_response
.
get_smf_context_uri
());
// Location header
response
.
headers
().
add
<
Pistache
::
Http
::
Header
::
ContentType
>
(
Pistache
::
Http
::
Mime
::
MediaType
(
json_format
));
response
.
send
(
Pistache
::
Http
::
Code
(
sm_context_response
.
get_http_code
()),
json_data
.
dump
().
c_str
());
}
else
{
body
=
json_data
.
dump
().
c_str
();
}
else
{
// otherwise, send reply without content
response
.
send
(
Pistache
::
Http
::
Code
(
sm_context_response
.
get_http_code
()));
return
;
}
response
.
send
(
Pistache
::
Http
::
Code
(
sm_context_response
.
get_http_code
()),
body
);
}
}
// namespace api
}
// namespace smf_server
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment