I have to create HTTP Server with POST requests that uses content type application/json. Request body consists of JSON body and there aren't request query parameters.
Request body contains the following json:
Code: Select all
{
"attribute1": 11,
"attribute2": 22
}
Example:
If I send a request with query parameters additionally with the JSON body I put before, my callback function only returns 2 items `queryAttribute1=33` and `queryAttribute2=44`. 'attribute1' and 'attribute2' values are not returned in the callback function.
http://127.0.0.1:3300/myMethod?queryAtt ... ribute2=44
Code: Select all
cbFunction(dyn_string dsParameter, dyn_string dsValue, const string sUser, const string sIP){
DebugTN(dsParameter);
DebugTN(dsValue);
}Code: Select all
WCCOActrl2:2021.05.03 17:10:10.048[dyn_string 2 items
WCCOActrl2: 1: "queryAttribute1"
WCCOActrl2: 2: "queryAttribute2"
WCCOActrl2:]
WCCOActrl2:2021.05.03 17:10:10.048[dyn_string 2 items
WCCOActrl2: 1: "33"
WCCOActrl2: 2: "44"
WCCOActrl2:]So my question is how can I write a httpConnect with Content type: application/json. Additionally, how can I access body of the request?
p.s.: Code snippet or an example CB function would be a huge help.
Thank you,
Eray