comit-network / comit-rs

Reference implementation of COMIT, an open protocol facilitating trustless cross-blockchain applications.
GNU General Public License v3.0
191 stars 33 forks source link

Error responses should correctly identify themselves as RFC7807: `application/problem+json` #1438

Closed thomaseizinger closed 4 years ago

thomaseizinger commented 5 years ago

Currently, we simply send back our instances of HttpApiProblem as JSON:

https://github.com/comit-network/comit-rs/blob/6616f56206b3a4d40feaaf15de40b9925a9dae6c/cnd/src/http_api/problem.rs#L149-L161

While not being wrong, it would be more correct to set the "content-type" header to application/problem+json to allow clients to actively identify them as "problems".

The http-api-problem library provides a constant for that: https://github.com/chridou/http-api-problem/blob/3e59dc7b1bdd6e35eb9ae749e93aef9579d57371/src/lib.rs#L133-L134

D4nte commented 4 years ago

@thomaseizinger back to backlog?