Skip to content
Myr

fix(validator): support `application/json` with a charset (#3199)

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

authored by Yusuke Wada · committed by GitHub · parent 0417830 · Browse files · 2 files+14 added−2 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+14 added−2 removed

  • tests:+12 added−0 removed
  • other:+2 added−2 removed

2 files+14 added−2 removed

modified:src/validator/validator.test.ts+12 added
134 unmodified lines
135 })136 expect(res.status).toBe(200)137 })138139 it('Should validate if Content-Type is a application/json with a charset', async () => {140 const res = await app.request('http://localhost/post', {141 method: 'POST',142 headers: {143 'Content-Type': 'application/json; charset=utf8',144 },145 body: JSON.stringify({ foo: 'bar' }),146 })147 expect(res.status).toBe(200)148 expect(await res.json()).toEqual({ foo: 'bar' })149 })150151 it('Should validate if Content-Type is a subtype like application/merge-patch+json', async () => {152 const res = await app.request('http://localhost/post', {153 method: 'POST',154 headers: {
1019 unmodified lines
modified:src/validator/validator.ts+2 added-2 removed