pico-engine icon indicating copy to clipboard operation
pico-engine copied to clipboard

The pico-engine qua web server should use standard HTTP response status codes

Open b1conrad opened this issue 4 years ago • 0 comments

When a /sky/cloud or /sky/event request comes in to the pico-engine, and has an unknown ECI, we currently send back a 200 Ok status response with an error message (e.x. {"error":"Error: ECI not found abcdefghijklmnopqrstuvwxyz"}) as the response body. This is incorrect, and instead a 404 Not found response should be returned.

Similarly, when the ECI is correct, but there is a policy violation, we should use one of the other 400 series codes, perhaps 403 Forbidden. Now we send back 200 Ok with the error mssage {"error":"Error: Not allowed by channel policy"} (which incidentally should maybe include more information such as the ECI, the domain/rid, and the name).

When we start moving picos from engine to engine, we may also want to use some of the 300 series codes.

b1conrad avatar Jan 04 '21 18:01 b1conrad