Closed fgalan closed 3 years ago
Not sure who could want a notification without information. You can always remove the subscription ... Has a user asked for this functionality?
The information could be in other parts of the request, like URL query parameters or headers. In fact, methods such as GET or DELETE (allowed in the current implementation of cutomized notification) don't typically used any payload.
The issue is motivated by a use case, although it has been workarrounded, so it doesn't have priority. @manucarrace and/or @mrutid could elaborate on the use case motivating this, if needed.
Nah, no need. I just found it a little surprising :)
Hi @kzangeli @fgalan sir
I have done investigation on this issue. following are the two concern:
As the type of payload is defined as string object so the NULL value can not assign to it. so we cannot replace "" (empty string) to NULL. In C++ std::string object should always initialized and always contains a string; its contents by default are an empty string ("").
If I declare payload as pointer in apiTypesV2/HttpInfo.h file and modified the method for payload in such a way so that it can handle the pointer . But due to this 7 to 8 test cases are getting failed.
Please let me know if you have any other opinion.
HttpInfo.h class has a payload
field of std::string
. However, this field is not expressive enough to be used to model the "no payload situation" needed by this issue.
I'd suggest to add a new field bool includePayload
to that class for that. That field will be set to true at parsing stage (in the case of finding "payload": null
in the request) and will be used at notification creating time to avoid including the payload.
Thanks for you help on this issue!
Hi @fgalan sir,
I've fixed the issue. Please check PR #3683 and if it is ok then please merge the PR in master branch.
Hi @fgalan Sir, Currently I have not found any solution to fix this issue PR #3683, So I am leaving this issue.
I'll try to take your PR https://github.com/telefonicaid/fiware-orion/pull/3683 ("duplicating" it to a new PR so I can add new commits) and try to finish it, so your valuable work so far doesn't get wasted :)
Implemented in PR #3850
The current customized notification implementation allow to define a custom payload (if "payload" field is provided with a non-empty value) or use the default one for NGSIv2 notifications (if "payload" field is ommited or it has "" value).
However, current implement lacks the posibility of not including payload at all, i.e. 0-length requests. You can use
"payload": " "
which produces a 1-byte empty payload, but it couldn't fit some server implementations.This issue is about implementing that possiblity. The following syntax could be used: