Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ipgallery.common.cpp
/
Microservice
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Registry
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
fb101b93
authored
Jul 10, 2018
by
Amir Aharon
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
1.5.3 fix GetContent
parent
cbac5752
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
11 deletions
CMakeLists.txt
README.md
src/impl/servers/Microservice_IRestServerEvppImpl.h
test/Microservice_Test.cpp
CMakeLists.txt
View file @
fb101b93
...
...
@@ -3,7 +3,7 @@ project(Microservice)
# version stuff
set
(
Microservice_VERSION_MAJOR 1
)
set
(
Microservice_VERSION_MINOR 5
)
set
(
Microservice_VERSION_PATCH
2
)
set
(
Microservice_VERSION_PATCH
3
)
set
(
Microservice_VERSION_STRING
${
Microservice_VERSION_MAJOR
}
.
${
Microservice_VERSION_MINOR
}
.
${
Microservice_VERSION_PATCH
}
)
# type build flags
...
...
README.md
View file @
fb101b93
## C++ Microservice Framework
*
to create microservice docker run script/build_microservice_docker.sh
[
version
]
## VERSIONS:
# 1.5.3
-
fix for IRequest->GetContent() in Evpp
# 1.5.2
-
Fix for sigegv
-
testing http client performance
...
...
src/impl/servers/Microservice_IRestServerEvppImpl.h
View file @
fb101b93
...
...
@@ -59,6 +59,7 @@ class Microservice_IRequestRestEvppImpl: public nsMicroservice_Iface::IRequest {
public
:
Microservice_IRequestRestEvppImpl
(
EvppConnParams
connParams
)
:
connParams_
(
connParams
)
{
queryString_
=
ParseQueryString
();
body_
=
connParams_
.
ctx_
->
body
().
ToString
();
}
const
char
*
ParseQueryString
()
{
...
...
@@ -82,10 +83,16 @@ public:
return
connParams_
.
ctx_
->
uri
().
c_str
();
}
/**
* @brief Get the Content object
* note that the body is a reference to a reusable buffer
* so we need to take into account the actual size
* @return const char*
*/
const
char
*
GetContent
()
override
{
// if (p_restMsg_)
// return p_restMsg_->content()->c_str();
return
connParams_
.
ctx_
->
body
().
data
()
;
return
body_
.
size
()
?
body_
.
c_str
()
:
nullptr
;
}
void
Reset
()
override
{
...
...
@@ -98,6 +105,7 @@ public:
private
:
EvppConnParams
connParams_
;
const
char
*
queryString_
;
std
::
string
body_
;
char
buff_
[
nsMicroservice_Constants
::
MAX_URI_LENGTH
];
};
...
...
test/Microservice_Test.cpp
View file @
fb101b93
...
...
@@ -82,15 +82,16 @@ public:
// CreateSync(pc_reqCtx);
}
else
{
MsgArchiverJsonLohmann
archiverJsonLohmann
;
nlohmann
::
json
outMsg
;
if
(
this
->
ReadObjectFromRequest
<>
(
pc_reqCtx
,
archiverJsonLohmann
,
outMsg
))
this
->
WriteObjectToResponse
<>
(
pc_reqCtx
,
archiverJsonLohmann
,
outMsg
);
// rapidjson::Document rpj_Doc;
// if (this->ReadObjectFromRequest(pc_reqCtx,rpj_Doc) )
// this->WriteObjectToResponse(pc_reqCtx,rpj_Doc);
// else
// this->SendErrorResp(pc_reqCtx,"Error in parsing json");
// MsgArchiverJsonLohmann archiverJsonLohmann;
// nlohmann::json outMsg;
// if (this->ReadObjectFromRequest<>(pc_reqCtx,archiverJsonLohmann,outMsg))
// this->WriteObjectToResponse<>(pc_reqCtx,archiverJsonLohmann,outMsg);
// else
rapidjson
::
Document
rpj_Doc
;
if
(
this
->
ReadObjectFromRequest
(
pc_reqCtx
,
rpj_Doc
)
)
this
->
WriteObjectToResponse
(
pc_reqCtx
,
rpj_Doc
);
else
this
->
SendErrorResp
(
pc_reqCtx
,
"Error in parsing json"
);
}
}
...
...
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