WebThingsIO / gateway

WebThings Gateway - a self-hosted web application for monitoring and controlling a building over the web
http://webthings.io/gateway
Mozilla Public License 2.0
2.62k stars 339 forks source link

`DELETE` on action should not require `Accept` header #3085

Open benfrancis opened 1 year ago

benfrancis commented 1 year ago

A cancelaction operation in the HTTP Basic Profile has the following requirements for a request:

Currently this is supported, but it only works if the client sets an Accept header with the value application/json.

If the Accept header is not included the request gets routed to the wrong place by the content negotiation middleware and provides an error response with an HTML payload. The request should not require an Accept header because it does not expect a body in the response.

The fix might require modifying the content negotiation middleware to default to JSON rather than HTML.