Skip to content

Commit

Permalink
RENAME setStatusCodeAndSmartRender() to setSCAndRender()
Browse files Browse the repository at this point in the history
  • Loading branch information
fgalan committed Aug 13, 2024
1 parent b984341 commit f2476c9
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
6 changes: 3 additions & 3 deletions src/lib/jsonParseV2/jsonRequestTreat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ std::string jsonRequestTreat
if ((answer = parseDataP->ent.res.check(EntitiesRequest)) != "OK")
{
OrionError oe(SccBadRequest, answer);
return oe.setStatusCodeAndSmartRender(&(ciP->httpStatusCode));
return oe.setSCAndRender(&(ciP->httpStatusCode));
}
break;

Expand All @@ -95,7 +95,7 @@ std::string jsonRequestTreat
if ((answer = parseDataP->ent.res.check(EntityRequest)) != "OK")
{
OrionError oe(SccBadRequest, answer);
return oe.setStatusCodeAndSmartRender(&(ciP->httpStatusCode));
return oe.setSCAndRender(&(ciP->httpStatusCode));
}
break;

Expand All @@ -111,7 +111,7 @@ std::string jsonRequestTreat
if ((answer = parseDataP->attr.attribute.check(false)) != "OK")
{
OrionError oe(SccBadRequest, answer);
return oe.setStatusCodeAndSmartRender(&(ciP->httpStatusCode));
return oe.setSCAndRender(&(ciP->httpStatusCode));
}
break;

Expand Down
8 changes: 4 additions & 4 deletions src/lib/parse/textParse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static std::string textParseAttributeValue(ConnectionInfo* ciP, ContextAttribute
else
{
OrionError oe(SccBadRequest, "Missing citation-mark at end of string");
return oe.setStatusCodeAndSmartRender(&(ciP->httpStatusCode));
return oe.setSCAndRender(&(ciP->httpStatusCode));
}
}

Expand Down Expand Up @@ -88,7 +88,7 @@ static std::string textParseAttributeValue(ConnectionInfo* ciP, ContextAttribute
else // 5. None of the above - it's an error
{
OrionError oe(SccBadRequest, "attribute value type not recognized");
return oe.setStatusCodeAndSmartRender(&(ciP->httpStatusCode));
return oe.setSCAndRender(&(ciP->httpStatusCode));
}

return "OK";
Expand Down Expand Up @@ -116,14 +116,14 @@ std::string textRequestTreat(ConnectionInfo* ciP, ParseData* parseDataP, Request
if ((answer = parseDataP->av.attribute.check(true)) != "OK")
{
OrionError oe(SccBadRequest, answer);
return oe.setStatusCodeAndSmartRender(&(ciP->httpStatusCode));
return oe.setSCAndRender(&(ciP->httpStatusCode));
}
break;

default:
OrionError oe(SccUnsupportedMediaType, "not supported content type: text/plain");

answer = oe.setStatusCodeAndSmartRender(&(ciP->httpStatusCode));
answer = oe.setSCAndRender(&(ciP->httpStatusCode));

alarmMgr.badInput(clientIp, "not supported content type", "text/plain");
break;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/rest/OrionError.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ void OrionError::fillOrAppend(HttpStatusCode _code, const std::string& fullDetai

/* ****************************************************************************
*
* OrionError::setStatusCodeAndSmartRender -
* OrionError::setSCAndRender -
*/
std::string OrionError::setStatusCodeAndSmartRender(HttpStatusCode* scP)
std::string OrionError::setSCAndRender(HttpStatusCode* scP)
{
*scP = code;
return toJson();
Expand Down
2 changes: 1 addition & 1 deletion src/lib/rest/OrionError.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ typedef struct OrionError
OrionError(HttpStatusCode _code, const std::string& _description = "", const std::string& _error = "");

std::string smartRender(void);
std::string setStatusCodeAndSmartRender(HttpStatusCode* scP);
std::string setSCAndRender(HttpStatusCode* scP);
std::string toJson(void);
void fill(HttpStatusCode _code, const std::string& _description, const std::string& _error = "");
void fill(const StatusCode& sc);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/rest/RestService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ static std::string restService(ConnectionInfo* ciP, RestService* serviceV)
{
OrionError oe(SccBadRequest, result);

std::string response = oe.setStatusCodeAndSmartRender(&(ciP->httpStatusCode));
std::string response = oe.setSCAndRender(&(ciP->httpStatusCode));

alarmMgr.badInput(clientIp, result);
restReply(ciP, response);
Expand Down
20 changes: 10 additions & 10 deletions src/lib/rest/rest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,14 +694,14 @@ int servicePathCheck(ConnectionInfo* ciP, const char* servicePath)
if (servicePath[0] != '/')
{
OrionError oe(SccBadRequest, "Only /absolute/ Service Paths allowed [a service path must begin with /]");
ciP->answer = oe.setStatusCodeAndSmartRender(&(ciP->httpStatusCode));
ciP->answer = oe.setSCAndRender(&(ciP->httpStatusCode));
return 1;
}

if (servicePath[1] == '/')
{
OrionError oe(SccBadRequest, "empty component in ServicePath");
ciP->answer = oe.setStatusCodeAndSmartRender(&(ciP->httpStatusCode));
ciP->answer = oe.setSCAndRender(&(ciP->httpStatusCode));
return 1;
}

Expand All @@ -710,13 +710,13 @@ int servicePathCheck(ConnectionInfo* ciP, const char* servicePath)
if (ciP->verb == PATCH)
{
OrionError oe(SccBadRequest, "more than one servicepath in patch update request is not allowed");
ciP->answer = oe.setStatusCodeAndSmartRender(&(ciP->httpStatusCode));
ciP->answer = oe.setSCAndRender(&(ciP->httpStatusCode));
return 1;
}
if (ciP->verb == DELETE)
{
OrionError oe(SccBadRequest, "more than one servicepath is not allowed in DELETE operation");
ciP->answer = oe.setStatusCodeAndSmartRender(&(ciP->httpStatusCode));
ciP->answer = oe.setSCAndRender(&(ciP->httpStatusCode));
return 1;
}
}
Expand All @@ -726,7 +726,7 @@ int servicePathCheck(ConnectionInfo* ciP, const char* servicePath)
if (components > SERVICE_PATH_MAX_LEVELS)
{
OrionError oe(SccBadRequest, "too many components in ServicePath");
ciP->answer = oe.setStatusCodeAndSmartRender(&(ciP->httpStatusCode));
ciP->answer = oe.setSCAndRender(&(ciP->httpStatusCode));
return 2;
}

Expand All @@ -735,14 +735,14 @@ int servicePathCheck(ConnectionInfo* ciP, const char* servicePath)
if (strlen(compV[ix].c_str()) > SERVICE_PATH_MAX_COMPONENT_LEN)
{
OrionError oe(SccBadRequest, "component-name too long in ServicePath");
ciP->answer = oe.setStatusCodeAndSmartRender(&(ciP->httpStatusCode));
ciP->answer = oe.setSCAndRender(&(ciP->httpStatusCode));
return 3;
}

if (compV[ix].c_str()[0] == 0)
{
OrionError oe(SccBadRequest, "empty component in ServicePath");
ciP->answer = oe.setStatusCodeAndSmartRender(&(ciP->httpStatusCode));
ciP->answer = oe.setSCAndRender(&(ciP->httpStatusCode));
return 3;
}

Expand All @@ -754,13 +754,13 @@ int servicePathCheck(ConnectionInfo* ciP, const char* servicePath)
if (ciP->verb == PATCH)
{
OrionError oe(SccBadRequest, "servicepath with wildcard # is not allowed in patch update request");
ciP->answer = oe.setStatusCodeAndSmartRender(&(ciP->httpStatusCode));
ciP->answer = oe.setSCAndRender(&(ciP->httpStatusCode));
return 3;
}
else if (ciP->verb == DELETE)
{
OrionError oe(SccBadRequest, "servicepath with wildcard # is not allowed in DELETE operation");
ciP->answer = oe.setStatusCodeAndSmartRender(&(ciP->httpStatusCode));
ciP->answer = oe.setSCAndRender(&(ciP->httpStatusCode));
return 3;
}
else
Expand All @@ -776,7 +776,7 @@ int servicePathCheck(ConnectionInfo* ciP, const char* servicePath)
if (!isalnum(comp[cIx]) && (comp[cIx] != '_'))
{
OrionError oe(SccBadRequest, "a component of ServicePath contains an illegal character");
ciP->answer = oe.setStatusCodeAndSmartRender(&(ciP->httpStatusCode));
ciP->answer = oe.setSCAndRender(&(ciP->httpStatusCode));
return 4;
}
}
Expand Down

0 comments on commit f2476c9

Please sign in to comment.