-
-
Notifications
You must be signed in to change notification settings - Fork 436
fix: Authorization Header 400 Bad Request #3512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
❌ Deploy Preview for zio-http failed. Why did it fail? →
|
Netlify deploy failed?, and the docs site wasn’t touched in this PR. Can we skip Netlify deploys for PRs? @jdegoes |
@jdegoes No idea why we're having this test fail, i've addressed the re-ordering of http.method.. [error] --- /home/runner/work/zio-http/zio-http/zio-http/jvm/src/test/scala/zio/http/endpoint/AuthorizationHeaderSpec.scala Error: Process completed with exit code 1. `package zio.http.endpoint import zio._ import zio.http.Method._ object AuthorizationHeaderSpec extends ZIOSpecDefault { |
@kyri-petrou Appreciate if you can review this, i'm not sure I have to do anything with the failed website build? |
@kyri-petrou is anything needed from my end? Thanks! Looking forward to contributing more to ZIO. |
Hey guys, can I do anything else on this PR to avoid failing redirect rules? |
Fixed: Wrong Error Code for Missing Authorization Header
Before, if the
Authorization
header was missing, the app returned a 400 Bad Request.That just means something went wrong, but it didn’t clearly say the user wasn't logged in.
Now, the app checks if the
Authorization
header is missing or invalid.If it is, it returns 401 Unauthorized, which correctly tells the user they need to log in.
Improvements
Authorization
header is missing, the response is now 401 UnauthorizedAuthorization
, the response is still 401 UnauthorizedAuthorization
header is present but invalid (decoding error), the response is 401 UnauthorizedCompliance
This fix follows RFC 7235, which says:
🧪 Tests
To confirm nothing else broke, I ran:
sbt "zioHttpJVM / Test / testOnly endpoint"
All tests passed ✅
It only changes how
Authorization
header issues are handled. Everything else stays the same./claim #3235