diff --git a/.changeset/flat-carpets-move.md b/.changeset/flat-carpets-move.md new file mode 100644 index 00000000000..ae3a2ce1a39 --- /dev/null +++ b/.changeset/flat-carpets-move.md @@ -0,0 +1,5 @@ +--- +"@atproto/oauth-provider": patch +--- + +Better report invalid content-encoding errors diff --git a/packages/oauth/oauth-provider/src/lib/http/stream.ts b/packages/oauth/oauth-provider/src/lib/http/stream.ts index 6262cd0299e..1d74991bd70 100644 --- a/packages/oauth/oauth-provider/src/lib/http/stream.ts +++ b/packages/oauth/oauth-provider/src/lib/http/stream.ts @@ -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 }) } }