Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple select options when multipart is true. #15

Merged
merged 1 commit into from Mar 25, 2015

Conversation

@tyler46
Copy link
Contributor

tyler46 commented Mar 24, 2015

Hi,

I have seen that when enctype of a form is multipart/form-data and there is a select html tag with multiple as attribute, then only last option is displayed at request.body.fields. I have tried to patched it to include also that case.

@dlau

This comment has been minimized.

Copy link
Owner

dlau commented Mar 25, 2015

Looks good to me, thanks!

dlau added a commit that referenced this pull request Mar 25, 2015
Support multiple select options when multipart is true.
@dlau dlau merged commit bf1b176 into dlau:master Mar 25, 2015
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@tyler46 tyler46 deleted the tyler46:add-select-multiple branch Mar 26, 2015
@tunnckoCore tunnckoCore mentioned this pull request Apr 7, 2016
9 of 16 tasks complete
tunnckoCore added a commit to tunnckoCore/koa-better-body that referenced this pull request Apr 8, 2016
tunnckoCore added a commit to tunnckoCore/koa-better-body that referenced this pull request Apr 15, 2016
v2 (#34)
* refactor
* fix npm install from github
* remove node v0.11
* re-add and update the changelog
* add more tests, add `buffer` option to get buffer body
* update tests
* update urlencoded tests
* cleanup utils.multipart
* update buffer logic and buffer tests, codeclimate ignore
* simplify, DRY, SoC
* update description
* more tests, working on #32
* make `multipart` option true by default - allow accepting and parsing multipart - pass false to disallow
* start multipart tests
* add files also to `this.body`, not only to `this.request.files`
* cleanup `utils.multipart` - unnecessary check
* skip multipart test for multiple files on same field
* handle multiples on same key - #32, #26 and dlau/koa-body#15
* move tests to `test/` dir
* update codeclimate ignore
* update verb.md
* add multipart test
* docs, verb config and readme features
* docs for utils.js, working #32
* start recipes, working #32
* add one more test for parsing json
* update readme, add recipes contributing guide section
* [recipe] formdiable instance and event handling (#36)
* add keywords
* update features list
tunnckoCore added a commit to tunnckoCore/opensource that referenced this pull request Sep 16, 2019
v2 (#34)
* refactor
* fix npm install from github
* remove node v0.11
* re-add and update the changelog
* add more tests, add `buffer` option to get buffer body
* update tests
* update urlencoded tests
* cleanup utils.multipart
* update buffer logic and buffer tests, codeclimate ignore
* simplify, DRY, SoC
* update description
* more tests, working on #32
* make `multipart` option true by default - allow accepting and parsing multipart - pass false to disallow
* start multipart tests
* add files also to `this.body`, not only to `this.request.files`
* cleanup `utils.multipart` - unnecessary check
* skip multipart test for multiple files on same field
* handle multiples on same key - #32, #26 and dlau/koa-body#15
* move tests to `test/` dir
* update codeclimate ignore
* update verb.md
* add multipart test
* docs, verb config and readme features
* docs for utils.js, working #32
* start recipes, working #32
* add one more test for parsing json
* update readme, add recipes contributing guide section
* [recipe] formdiable instance and event handling (#36)
* add keywords
* update features list
tunnckoCore added a commit to tunnckoCore/opensource that referenced this pull request Sep 16, 2019
* fixes #3

* remove npmignore

* v1.0.5

* badge, coverage battle

* badge, coverage battle

* 97% coverage

* 97% coverage

* oops, delete index2.js

* update automation

* add makefile, improve coverage

* v1.0.6

* oops, fix

* update new 413 header name

* v1.0.7

* ooops, forgot to update history.md

* release v1.0.7

* v1.0.7

* v1.0.7

* commit from .bashrc

* commit from .bashrc

* Release v1.0.8

* bump `jscs-jsdoc` and .jscsrc

* Release v1.0.9

* testing verb 0.3.0

* update node version, coveralls.yml, tweaks

* Release v1.0.10

* fix code style collisions

* Release v1.0.11

* bump jscs and jscs-jsdoc

* Release v1.0.12

* Adding option to change `files` key

Also fix for issue #6

* Fix error, where `defaults` get mutated

Before this every creation of a new instance of this middleware resulted in overwritten `defaults` object. This object should remain unchanged, so that different instances could be using different options, without explicitly stating the default values.

For example:
```
var mw1 = koaBetterBody({ fieldsField: false });
var mw2 = koaBetterBody();
```
Before the fix, the `mw2` middleware has set `fieldsField` option to `false` instead of `'fields'`. Now it should be correctly set as `'fields'`.

* docs

* update dotfiles

* update package.json

* run lint

* update license year

* add test for custom filesKey option

* fix scripts

* fix scripts tests

* fix license year in dotfiles

* fix travis

* fix license in jshint

* Release v1.0.13

* closes #10, update/add tests

* increase max statements to 20

* coverage tweaks

* istanbul ignore

* Release v1.0.14

* add `encode` alias for `encoding` option

* Release v1.0.15

* add `opts.extendTypes`

* Release v1.0.16

* bump deps

* update keywords

* run update readme

* fix license range

* back `formidable` to ~1.0.16, which no matters

* Release v1.0.17

* faster travis and iojs + v0.12 support

* Use co-better-body and enable qs options

* Update docs

* run update readme

* update docblock

* Delete request fails

We need a default value for cache.fields.

Context:
   fieldsKey is false
   filesKey is not false (any string)

When delete request is done no body is sent, so cache.fields is undefined and on line 119 returns puts to undefined the line 128 continues and code crashes.

* add notice for v2

* Updated readme to reflect actual defaults for fieldsKey and filesKey.

* register formidable events via config, fix #27

* add test for formidable event

* don't break on empty bodies (empty posts)

* v2 (#34)

* refactor
* fix npm install from github
* remove node v0.11
* re-add and update the changelog
* add more tests, add `buffer` option to get buffer body
* update tests
* update urlencoded tests
* cleanup utils.multipart
* update buffer logic and buffer tests, codeclimate ignore
* simplify, DRY, SoC
* update description
* more tests, working on #32
* make `multipart` option true by default - allow accepting and parsing multipart - pass false to disallow
* start multipart tests
* add files also to `this.body`, not only to `this.request.files`
* cleanup `utils.multipart` - unnecessary check
* skip multipart test for multiple files on same field
* handle multiples on same key - #32, #26 and dlau/koa-body#15
* move tests to `test/` dir
* update codeclimate ignore
* update verb.md
* add multipart test
* docs, verb config and readme features
* docs for utils.js, working #32
* start recipes, working #32
* add one more test for parsing json
* update readme, add recipes contributing guide section
* [recipe] formdiable instance and event handling (#36)
* add keywords
* update features list

* Release v2.0.0

* chore(package): update lazy-cache to version 2.0.0 (#41)

https://greenkeeper.io/

* downloads badge

* switch to use `mukla` for testing

* fix description

* Release v2.0.1

* chore(package): update mukla to version 0.4.1 (#44)

https://greenkeeper.io/

* fixes #50: no more writing to `ctx.body` - everything is only on `ctx.request` - `ctx.request.files`, `ctx.request.fields` and when buffer/text it is only on `ctx.request.body. One more fixed thing is fields on `ctx.body[fieldName]` and `ctx.request[fieldName]` - they will still be (but only) on ctx.request.fields[fieldName]

* update docs

* chore(package): update supertest to version 2.0.0 (#54)

https://greenkeeper.io/

* fix for standard@8

* add opts.urlencodedLimit alias for opts.formLimit

* address #52: split buffer parsing from text parsing

* address #52: implement extendTypes.custom and opts.handler

* call opts.handler with context, update test for extendTypes.custom

* noop generator function opts.handler

* fix context of multipart parser, fix typo

* add options.handler docs

* add querystring option; add notes about extendTypes and querystring parsing

* add tests for `app.querystring` and `opts.querystring`

* update tests

* fix codeclimate "issue"

* docs: closes #51

* run verb, docs #51

* update travis, gitignore, npm scripts, devDeps

* fixes #55, fixes #61, update tests, add `form` recipe

* fallback mode for opts.delimiter -> opts.sep

* update docs: document new options and the aliases

* fix possible build fails

* update contributing guide

* fix links in contributing.md

* chore(dotfiles): update dotfiles, npm scripts, hooks, CONTRIBUTING.md

use `standard-version` for releasing, `husky` for git hooks, travis to point to `report-coverage`

script and few links to CON

* Release v3.0.0

* chore(example.js): add working `koa-router` example in root

Do not forget to read the docs, review the recipes, tests and code base before submitting not

helping issues such as #64.

* docs(example): add section for `koa-router` with working `./example.js`

* fix(package.json): update npm scripts, remove some devDeps

Pushing this as fix(), because i dont want empty section in my CHANGELOG. But anyway. In this patch

I just add example.js in repository root and same example in the readme.

* chore(release): 3.0.1

* fix(utils.js): qs: query string parsing options

Fix a possible bug if user pass custom `options.delimiter`

Fixes #63

* chore(release): 3.0.2

* fix(ampersand): bug when value has ampersand

* fix(test): multipart test

* fix(test): add failing test

* fix(index.js): ampersand within string no longer creates new field

* fix(test): add test for field with three or more values

* fix(doc): update extendTypes link (#82)

* fix(koa2): remove ctx.querystring (#84)

fixes #77

* fix(readme): update router example

basically `koa-better-router` is almost the same, but more customizable, composable, flexible and lightweight.

* chore(release): 3.0.3

* fix(style): update standard and format codebase

* fix(prettier): format codebase

* fix(lint): update linting, remove lazy-cache

use eslint for lint, install both eslint and standard intentionally

* fix(package): update scripts and travis

* fix(travis): install more stable npm for better results

we need falt deps architecture for that trick

* fix(style): proper naming

* chore(release): 3.0.4

* fix(readme): add note for the new v4 release

* Configure Renovate (#92)

* Add renovate.json

* chore(renovate): update config

* refactor(deps): Renovate Pin Dependencies packages

* chore(deps): Update dependency cz-conventional-changelog to version 2.x (#93)

* chore(renovate): hm, test `automerge: any`

* chore(deps): Update dependency koa-route to version 3.2.0

* chore(deps): Update dependency nyc to version 11.0.3

* chore(deps): Update dependency standard-version to version 4.2.0

* chore(deps): Update dependency supertest to version 3.x (#101)

* chore(deps): Update dependency nyc to version 11.1.0

* chore(deps): update dependency eslint to v4.4.0

* chore(deps): update dependency standard to v10.0.3

* chore(deps): update dependency eslint to v4.4.1

* chore(deps): update dependency eslint to v4.5.0

* chore(deps): update dependency npm-run-all to v4.1.0

* chore(deps): update lock file

* chore(deps): update dependency npm-run-all to v4.1.1

* chore(deps): update dependency eslint to v4.6.0

* chore(deps): update dependency eslint to v4.6.1

* chore(deps): update dependency nyc to v11.2.0

* chore(deps): update dependency nyc to v11.2.1

* chore(deps): update dependency qs to v6.5.1

* chore(deps): update lock file

* chore(deps): update dependency eslint to v4.7.0

* chore(deps): update dependency eslint to v4.7.1

* chore(deps): update dependency eslint to v4.7.2

* chore(deps): update lock file

* chore(deps): update dependency coveralls to v2.13.2

* chore(deps): update dependency coveralls to v2.13.3

* chore(deps): update dependency coveralls to v3.0.0

* chore(deps): update dependency eslint to v4.8.0

* chore(deps): update lock file

* chore(deps): update lock file

* chore(deps): update dependency koa to v1.4.1

* chore(deps): update dependency eslint to v4.9.0

* chore(deps): update dependency is-buffer to v1.1.6

* chore(deps): update dependency cz-conventional-changelog to v2.1.0

* chore(deps): update dependency eslint to v4.10.0

* chore(deps): update lock file

* chore(deps): update dependency eslint to v4.17.0

* chore(deps): update dependency koa to v1.5.1

* chore(deps): update dependency npm-run-all to v4.1.2

* chore(deps): update dependency nyc to v11.4.1

* chore(deps): update dependency standard-version to v4.3.0

* chore(deps): update dependency is-buffer to v2.0.0

* fix(deps): update dependency extend-shallow to v3.0.2

* chore(deps): update dependency koa to v1.6.0

* chore(deps): update dependency eslint to v4.18.1

* chore(deps): update dependency eslint to v4.18.2

* chore(deps): update dependency koa to v2.5.0

* fix(deps): update dependency formidable to v1.2.0

* chore(deps): update dependency standard to v11.0.0

* chore(deps): update dependency nyc to v11.6.0

* chore(deps): update dependency standard to v11.0.1

* chore(deps): update dependency eslint to v4.19.0

* fix(deps): update dependency formidable to v1.2.1

* chore(deps): update dependency eslint to v4.19.1

* chore(deps): update dependency koa to v2.5.1

* chore(deps): update dependency is-buffer to v2.0.2

* chore(deps): update dependency coveralls to v3.0.1

* chore(deps): update dependency npm-run-all to v4.1.3

* chore(deps): update dependency supertest to v3.1.0

* chore(deps): update dependency nyc to v11.7.3

* chore(deps): update dependency nyc to v11.8.0

* chore(deps): update dependency standard-version to v4.4.0

* chore(deps): update dependency commitizen to v2.10.1

* chore(deps): update dependency nyc to v12

* chore(deps): update dependency nyc to v12.0.2

* chore(deps): update dependency is-buffer to v2.0.3

* chore(deps): update dependency eslint to v5

* chore(deps): update dependency eslint to v5.0.1

* chore(deps): update dependency coveralls to v3.0.2

* chore(deps): update dependency eslint to v5.1.0

* chore(deps): update dependency koa to v2.5.2

* chore(deps): update dependency eslint to v5.2.0

* chore(deps): update dependency qs to v6.5.2

* chore(deps): update dependency eslint to v5.3.0

* chore(deps): update dependency eslint to v5.4.0

* chore(deps): update dependency nyc to v13

* chore(deps): update dependency eslint to v5.5.0

* chore(deps): update dependency supertest to v3.2.0

* chore(deps): update dependency supertest to v3.3.0

* chore(deps): update dependency koa to v2.5.3

* chore(deps): update dependency eslint to v5.6.0

* chore(deps): update dependency eslint to v5.6.1

* chore(deps): update dependency commitizen to v3

* chore(deps): update dependency commitizen to v3.0.2

* chore(deps): update dependency eslint to v5.7.0

* chore(deps): update dependency nyc to v13.1.0

* chore(deps): update dependency commitizen to v3.0.4

* chore(deps): update dependency koa to v2.6.1

* chore(deps): update dependency eslint to v5.8.0

* chore(deps): update dependency koa to v2.6.2

* chore(deps): update dependency eslint to v5.9.0

* chore(deps): update dependency npm-run-all to v4.1.5

* chore(deps): update dependency qs to v6.6.0

* chore(deps): update dependency commitizen to v3.0.5

* chore(deps): update dependency eslint to v5.10.0

* chore(deps): update dependency eslint to v5.11.0

* chore(deps): update dependency eslint to v5.11.1

* chore(deps): update dependency eslint to v5.12.0

* chore(deps): update dependency supertest to v3.4.1

* chore(deps): update dependency eslint to v5.12.1

* chore(deps): update dependency supertest to v3.4.2

* chore: update renovate config

* chore: switch to semanticPrefixFixDepsChoreOthers

* chore: update readme stuff

Signed-off-by: Charlike Mike Reagent <mameto2011@gmail.com>

* chore(deps): update dependency coveralls to v3.0.3 (#188)

Signed-off-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency commitizen to v3.1.1 (#187)

Signed-off-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency supertest to v4 (#194)

Signed-off-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency eslint to v5.16.0 (#189)

Signed-off-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency standard-version to v6 (#193)

Signed-off-by: Renovate Bot <bot@renovateapp.com>

* chore: lock koa to v1 tag

* chore: delete package-lock

* chore(travis): do not update npm to latest

* chore(travis): do no test on Node 4 & 5

trying to find some easy way to light green build status without too much work and upgrades or major releases...

* chore(deps): update dependency coveralls to v3.0.4

Signed-off-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency coveralls to v3.0.5

Signed-off-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency commitizen to v3.1.2

Signed-off-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency commitizen to v4

Signed-off-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency commitizen to v4.0.1

Signed-off-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency commitizen to v4.0.2

Signed-off-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency cz-conventional-changelog to v3

Signed-off-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency commitizen to v4.0.3

Signed-off-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency cz-conventional-changelog to v3.0.2

Signed-off-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency standard-version to v7

Signed-off-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency coveralls to v3.0.6

Signed-off-by: Renovate Bot <bot@renovateapp.com>

* chore(deps): update dependency qs to v6.8.0

Signed-off-by: Renovate Bot <bot@renovateapp.com>


Co-authored-by: Charlike Mike Reagent <mamemto_100@mail.bg>
Co-authored-by: Marek Pepke <pepkin88@gmail.com>
Co-authored-by: Dan <danrosenshain@gmail.com>
Co-authored-by: Luis Carlos Cruz Carballo <lcruzc@linkux-it.com>
Co-authored-by: Alex McNamara <alex.mcnamara@outreach.io>
Co-authored-by: Creeper <yangcreeper@hotmail.com>
Co-authored-by: Sanders DeNardi <sedenardi@gmail.com>
Co-authored-by: Greenkeeper <support@greenkeeper.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.