Skip to content

Commit

Permalink
Improve urlencoded header detection regex
Browse files Browse the repository at this point in the history
  • Loading branch information
simov committed Dec 12, 2014
1 parent 202718d commit f5a07a6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion request.js
Expand Up @@ -1482,7 +1482,7 @@ Request.prototype.json = function (val) {

self._json = true
if (typeof val === 'boolean') {
if (self.body !== undefined && !/application\/x-www-form-urlencoded/.test(self.getHeader('content-type'))) {
if (self.body !== undefined && !/^application\/x-www-form-urlencoded\b/.test(self.getHeader('content-type'))) {
self.body = safeStringify(self.body)
if (!self.hasHeader('content-type')) {
self.setHeader('content-type', 'application/json')
Expand Down

0 comments on commit f5a07a6

Please sign in to comment.