Commit 4b299810 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Remove hardcoded value for http response code

parent 6faa7cb6
......@@ -138,8 +138,9 @@ void ausf_client::curl_http_client(
nlohmann::json response_data = {};
if (httpCode != 200 && httpCode != 201 &&
httpCode != 204) { // TODO: remove hardcoded values
if (httpCode != HTTP_RESPONSE_CODE_OK &&
httpCode != HTTP_RESPONSE_CODE_CREATED &&
httpCode != HTTP_RESPONSE_CODE_NO_CONTENT) {
is_response_ok = false;
if (response.size() < 1) {
Logger::ausf_app().info("There's no content in the response");
......@@ -176,6 +177,5 @@ void ausf_client::curl_http_client(
free(body_data);
body_data = NULL;
}
// fflush(stdout);
return;
}
......@@ -55,7 +55,7 @@ using namespace libconfig;
namespace config {
//------------------------------------------------------------------------------
ausf_config::ausf_config() : sbi() {
ausf_config::ausf_config() : sbi(), ausf_name(), pid_dir(), instance() {
udm_addr.ipv4_addr.s_addr = INADDR_ANY;
udm_addr.port = 80;
udm_addr.api_version = "v1";
......
......@@ -83,4 +83,31 @@ typedef struct {
typedef uint64_t supi64_t;
// 3GPP TS 29.571 (Common data)
enum http_response_codes_e {
HTTP_RESPONSE_CODE_OK = 200,
HTTP_RESPONSE_CODE_CREATED = 201,
HTTP_RESPONSE_CODE_ACCEPTED = 202,
HTTP_RESPONSE_CODE_NO_CONTENT = 204,
HTTP_RESPONSE_CODE_BAD_REQUEST = 400,
HTTP_RESPONSE_CODE_UNAUTHORIZED = 401,
HTTP_RESPONSE_CODE_FORBIDDEN = 403,
HTTP_RESPONSE_CODE_NOT_FOUND = 404,
HTTP_RESPONSE_CODE_METHOD_NOT_ALLOWED = 405,
HTTP_RESPONSE_CODE_REQUEST_TIMEOUT = 408,
HTTP_RESPONSE_CODE_406_NOT_ACCEPTED = 406,
HTTP_RESPONSE_CODE_CONFLICT = 409,
HTTP_RESPONSE_CODE_GONE = 410,
HTTP_RESPONSE_CODE_LENGTH_REQUIRED = 411,
HTTP_RESPONSE_CODE_PRECONDITION_FAILED = 412,
HTTP_RESPONSE_CODE_PAYLOAD_TOO_LARGE = 413,
HTTP_RESPONSE_CODE_URI_TOO_LONG = 414,
HTTP_RESPONSE_CODE_UNSUPPORTED_MEDIA_TYPE = 415,
HTTP_RESPONSE_CODE_TOO_MANY_REQUESTS = 429,
HTTP_RESPONSE_CODE_INTERNAL_SERVER_ERROR = 500,
HTTP_RESPONSE_CODE_NOT_IMPLEMENTED = 501,
HTTP_RESPONSE_CODE_SERVICE_UNAVAILABLE = 503,
HTTP_RESPONSE_CODE_GATEWAY_TIMEOUT = 504
};
#endif
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