Skip to content
Myr

fix(validator): Allow form data will mutliple values appended (#3273)

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

authored by Nick Randall · committed by GitHub · parent 81a1f07 · Browse files · 2 files+20 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+20 added−5 removed

  • tests:+15 added−0 removed
  • other:+5 added−5 removed

2 files+20 added−5 removed

modified:src/validator/validator.test.ts+15 added
258 unmodified lines
259 expect(await res.json()).toEqual({260 'foo[]': ['bar1', 'bar2'],261 })262 })263264 it('Should return `foo` as an array if multiple values are appended', async () => {265 const form = new FormData()266 form.append('foo', 'bar1')267 form.append('foo', 'bar2')268 form.append('foo', 'bar3')269 const res = await app.request('/post', {270 method: 'POST',271 body: form,272 })273 expect(res.status).toBe(200)274 expect(await res.json()).toEqual({275 foo: ['bar1', 'bar2', 'bar3'],276 })277 })278})279280describe('Malformed FormData request', () => {281 const app = new Hono()
912 unmodified lines
modified:src/validator/validator.ts+5 added-5 removed