Fixed the auth header missing error to 401 from 400#3614
Fixed the auth header missing error to 401 from 400#3614
Conversation
✅ Deploy Preview for zio-http ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Hey @jdegoes @987Nabil @kyri-petrou @vigoo , |
|
Thanks for the contribution and for raising this issue! We've implemented a different approach for this: Instead of hardcoding 401, the auth failure response status is now configurable via The default was changed to 404 because returning 401 reveals that the resource exists — for example, GitHub returns 404 instead of 401 when you try to access a repo you're not part of. Users who want RFC-compliant 401 can opt in: endpoint.auth(AuthType.Bearer).unauthorizedStatus(Status.Unauthorized)The OpenAPI spec generation also reflects the configured status automatically. This will be included in the next release. Thanks again for bringing attention to this issue! |
This PR fixes a bug where missing Authorization headers in declarative endpoint syntax were incorrectly returning HTTP 400 (Bad Request) instead of the RFC-compliant HTTP 401 (Unauthorized) status code.
Closes #3235
/claim #3235