Earlier, we were setting response code for POST only if a new resource
is created assuming that the value is by default OK.
TE tests showed error on using different version of Ubuntu.
Modified simpleserver to explicitly add OK status.
Added constructors to OCResourceRequest and
OCResourceResponse classes to avoid undefined behavior.
This Fixes IOT-128.
Change-Id: I13faff2fb254c777ccc8c8979824d53f5111ab3e
Signed-off-by: omkar <omkar.m.hegde@intel.com>
pResponse->setResponseResult(OC_EH_RESOURCE_CREATED);
pResponse->setNewResourceUri(rep_post.getValue<std::string>("createduri"));
}
+ else
+ {
+ pResponse->setResponseResult(OC_EH_OK);
+ }
if(OC_STACK_OK == OCPlatform::sendResponse(pResponse))
{
public:
typedef std::shared_ptr<OCResourceRequest> Ptr;
+ OCResourceRequest():
+ m_requestType{},
+ m_resourceUri{},
+ m_queryParameters{},
+ m_requestHandlerFlag{},
+ m_representation{},
+ m_observationInfo{},
+ m_headerOptions{},
+ m_requestHandle{nullptr},
+ m_resourceHandle{nullptr}
+ {
+ }
+
/**
* Virtual destructor
*/
public:
typedef std::shared_ptr<OCResourceResponse> Ptr;
- OCResourceResponse()
- {}
+ OCResourceResponse():
+ m_newResourceUri{},
+ m_errorCode{},
+ m_headerOptions{},
+ m_interface{},
+ m_representation{},
+ m_requestHandle{nullptr},
+ m_resourceHandle{nullptr},
+ m_responseResult{}
+ {
+ }
virtual ~OCResourceResponse(void) {}