vert-x3 / vertx-web

HTTP web applications for Vert.x
Apache License 2.0
1.11k stars 535 forks source link

Add accept header in case of a 415 error #2672

Closed komape closed 1 day ago

komape commented 3 weeks ago

Motivation:

Refer to issue #2663 for additional context regarding this PR.

This update introduces an Accept header in the response for situations where an unmatched content type leads to a 415 error. The header specifies the accepted content types following the format outlined in RFC 9110:

<type>/<subtype>; <param_key>=<param_value>

Examples:

text/html; boo=ya
text/html
text/*
*/json
text/html; boo
text/html, application/json
text/html; boo=ya, application/json
text/html; boo=ya, text/html; works
text/html; boo="yeah, right"
text/html; boo="yeah\"right"

This enhancement aims to improve content negotiation and provide clearer guidance to clients regarding acceptable content types.

This PR closes #2663.

komape commented 3 weeks ago

@tsegismont Seems like the test are executed properly 👍 I'll try to fix the issues.

komape commented 2 weeks ago

@tsegismont Let me know what you think of the values for the Accept header. The standard for it is not very precise on it and has some leeway in the design. I did what I think is the best but I'm open for opinions 😉

tsegismont commented 1 day ago

Thank you @komape , I went ahead and merged the PR