Skip to content

Commit

Permalink
code: include unsupported protocol message in 412 error response body
Browse files Browse the repository at this point in the history
  • Loading branch information
Klowner committed Nov 29, 2023
1 parent fc9d9ad commit ddaa454
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/core/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,13 @@ export class Tussle {
}

function respondWithUnsupportedProtocolVersion<T, P>(ctx: TussleIncomingRequest<T, P>): TussleIncomingRequest<T, P> {
const version = ctx.request.getHeader('tus-resumable');
ctx.response = {
status: 412, // precondition failed
headers: {
...ctx.response?.headers,
},
body: `Unsupported protocol version (received: "${version}")`,
};
return ctx;
}
Expand Down

0 comments on commit ddaa454

Please sign in to comment.