Skip to content

Commit

Permalink
Fix charset validation for urlencoded
Browse files Browse the repository at this point in the history
  • Loading branch information
Phillip9587 committed Jan 13, 2025
1 parent debe0a3 commit 96fada8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/types/urlencoded.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@ function urlencoded (options) {

var extended = Boolean(opts.extended)
var type = opts.type || 'application/x-www-form-urlencoded'
var charset = opts.charset || 'utf-8'

var queryparse = opts.parser || createQueryParser(opts, extended)

return genericParser(opts, {
type: type,
charset: charset,

charset: function validateCharset (charset) {
return charset === 'utf-8' || charset === 'iso-8859-1'
},

parse: function parse (body, encoding) {
return body.length
Expand Down

0 comments on commit 96fada8

Please sign in to comment.