-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarify the behavior when a response does not have body #360
Comments
+1 Also it would be good to specify the behaviour around the null type where this topic is discussed. |
@lu-zero wrote:
Note that an empty JSON string (as in two double quotation marks as opposed to just an empty body) could actually be a valid action input (e.g. to reset the message on an LED matrix display by passing the value
That would be an invalid input if the
That's a better idea. Although if a Thing is expecting an input then it should probably be checking that a valid body was supplied, and if it isn't expecting an input it can just ignore the body. @egekorkan wrote:
What behaviour do you think needs to be defined? One limitation of the current profiles is that they currently assume all payloads of properties, actions and events are JSON. We have use cases in WebThings where the |
I just wanted to say explained in detail since emptiness can mean different things to people: empty body, a JSON null, an empty object, empty string and probably some other things. So when this paragraph to explain this is added, I would just recommend to be more verbose. For me only the empty body is true "emptiness" but as stated above, the spec actually asks the implementations to still set the header to json in case of empty payload. I think it is fine as it is specified, just some explanations are helpful for implementers. |
That's a good example of the papercut: We could consider the http+deserializer that misbehave non-standard and be done with that, but maybe just suggest to avoid the problem and suggest to avoid setting information that is unnecessary because there is no body. |
I recall discussing these topics, but I am not sure where. Probably, when I refactored the protocol interface in node-wot or when we discussed the new template for payload bindings in Protocol Bindings Templates. I think these general guidelines should first be defined in the corresponding protocol binding template and then narrowed at will in the profiles. I know it is kind of a convoluted approach but we should keep these efforts in sync. |
Shall we make sure the protocol-level |
Linking some old issues: w3c/wot-binding-templates#184 |
We mention in https://w3c.github.io/wot-profile/#http-basic-profile-protocol-binding-invokeaction and other places:
Since some http implementation unhelpfully may pass the empty string to a json deserialiser, might be useful to suggest to either explicitly pass "{}" or not set the Content-Type if there isn't a body.
The text was updated successfully, but these errors were encountered: