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

Possible `content-type` header duplication #188

delaguilaluis opened this issue Aug 9, 2017 · 1 comment

Possible `content-type` header duplication #188

delaguilaluis opened this issue Aug 9, 2017 · 1 comment


Copy link

@delaguilaluis delaguilaluis commented Aug 9, 2017

If a wreck request has an existing options.payload, a content-type header with the value "application/json" is added to the headers even if a Content-Type header (that is not lower cased) exists under options.headers.

Example snippet:

'use strict'

const wreck = require('wreck')
const http = require('http')
const assert = require('assert')

const server = http.createServer(requestListener)

const options = {
  payload: [{ op: 'remove', path: '/test' }],
  headers: {
    'Content-Type': 'application/json-patch+json'

server.listen(0, () => {
  wreck.request('post', 'http://localhost:' + server.address().port, options, (err, res) => {
    if (err) throw err

function requestListener (req, res) {
  assert.equal(req.headers['content-type'], 'application/json-patch+json')
  res.writeHead(200, { 'Content-Type': 'text/plain' })

// => AssertionError [ERR_ASSERTION]: 'application/json' == 'application/json-patch+json'
@geek geek added the bug label Aug 9, 2017
@geek geek added this to the 12.2.3 milestone Aug 10, 2017
@geek geek self-assigned this Aug 10, 2017

This comment has been minimized.

Copy link

@geek geek commented Aug 10, 2017

Fixed by #189

@geek geek closed this Aug 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.