useid / handlersjs

MIT License
3 stars 3 forks source link

Undefined `Accept` header should not return 415 Unsupported Media Type #208

Closed lem-onade closed 2 years ago

lem-onade commented 2 years ago

When no Accept header is set, a request handled by the HttpHandlerStaticAssetService returns 415 with body No accept header found.

I think not specifying the Accept header should equal an Accept header with value */* (the latter does work).

example failing request (make sure no accept header is set automatically):

GET /openapi HTTP/1.1
Host: test.api.use.id

If the Accept header is not set, return whatever media type the static asset has, like would be done for an Accept: */* header. Do not set the incoming Accept header to */*, as that would be incorrect. Just treat it in the same way.

┆Issue is synchronized with this Wrike task by Unito

lem-onade commented 2 years ago

Q: am I correct in assuming that an undefined Accept header === Accept: */*?

lem-onade commented 2 years ago

from https://www.rfc-editor.org/rfc/rfc7231#section-5.3.2

A request without any Accept header field implies that the user agent will accept any media type in response.

So it seems my assumption was correct