Skip to content

Commit

Permalink
Better report invalid content-encoding errors
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieusieben committed Oct 21, 2024
1 parent 10cde98 commit e09a6d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/flat-carpets-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@atproto/oauth-provider": patch
---

Better report invalid content-encoding errors
6 changes: 4 additions & 2 deletions packages/oauth/oauth-provider/src/lib/http/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ import {
export function decodeHttpRequest(req: IncomingMessage): Readable {
try {
return decodeStream(req, req.headers['content-encoding'])
} catch (err) {
throw createHttpError(415, err, { expose: err instanceof TypeError })
} catch (cause) {
const message =
cause instanceof TypeError ? cause.message : `Invalid content-encoding`
throw createHttpError(415, message, { cause })
}
}

Expand Down

0 comments on commit e09a6d8

Please sign in to comment.