Skip to content

Commit

Permalink
fix(middleware/cors): explicitly return No Content for statusText in …
Browse files Browse the repository at this point in the history
…options request (#3719)
  • Loading branch information
shawncarr authored Dec 4, 2024
1 parent 80c7e22 commit fc8fb0f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/middleware/cors/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ describe('CORS by Middleware', () => {
const res = await app.request(req)

expect(res.status).toBe(204)
expect(res.statusText).toBe('No Content')
expect(res.headers.get('Access-Control-Allow-Methods')?.split(',')[0]).toBe('GET')
expect(res.headers.get('Access-Control-Allow-Headers')?.split(',')).toEqual([
'X-PINGOTHER',
Expand Down
2 changes: 1 addition & 1 deletion src/middleware/cors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export const cors = (options?: CORSOptions): MiddlewareHandler => {
return new Response(null, {
headers: c.res.headers,
status: 204,
statusText: c.res.statusText,
statusText: 'No Content',
})
}
await next()
Expand Down

0 comments on commit fc8fb0f

Please sign in to comment.