Skip to content
Myr

feat(cors): allow QUERY by default as a first-class method (#5115)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Taku Amano · committed by Yusuke Wada · parent 2159deb · Browse files · 2 files+18 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+18 added−5 removed

  • tests:+16 added−3 removed
  • other:+2 added−2 removed

2 files+18 added−5 removed

modified:src/middleware/cors/index.test.ts+16 added-3 removed
143 unmodified lines
144 expect(res.headers.get('Vary')).toBeNull()145 })146147 it('Preflight default', async () => {148 const req = new Request('https://localhost/api/abc', { method: 'OPTIONS' })149 req.headers.append('Access-Control-Request-Headers', 'X-PINGOTHER, Content-Type')148 const req = new Request('https://localhost/api/abc', {149 method: 'OPTIONS',150 headers: {151 'Access-Control-Request-Method': 'QUERY',152 'Access-Control-Request-Headers': 'X-PINGOTHER, Content-Type',153 },154 })155 const res = await app.request(req)156157 expect(res.status).toBe(204)158 expect(res.statusText).toBe('No Content')154 expect(res.headers.get('Access-Control-Allow-Methods')?.split(',')[0]).toBe('GET')159 expect(res.headers.get('Access-Control-Allow-Methods')?.split(',')).toEqual([160 'GET',161 'HEAD',162 'PUT',163 'POST',164 'DELETE',165 'PATCH',166 'QUERY',167 ])168 expect(res.headers.get('Access-Control-Allow-Headers')?.split(',')).toEqual([169 'X-PINGOTHER',170 'Content-Type',171 ])
322 unmodified lines
modified:src/middleware/cors/index.ts+2 added-2 removed