dareid / chakram

REST API test framework. BDD and exploits promises
http://dareid.github.io/chakram/
MIT License
908 stars 99 forks source link

Headers seem not correctly parsed #95

Closed antoine-pous closed 7 years ago

antoine-pous commented 7 years ago

Hi!

i encounter a strange error when i try to test the headers:

describe("Test server errors", function() {

  it('Should return an error 0x04', function() {

    let res = chakram.get(host + '/v4/path')

    expect(res)
      .to.have.status(401)
      .to.have.header('content-type', 'application/json')
      .to.have.header('charset', 'utf-8')
      .to.comprise.of.json({'error':{'id':'0x04', 'msg':'Authentication required!'}})

    return chakram.wait()
  })

})

AssertionError: expected header content-type with value application/json; charset=utf-8 to match application/json

I dont understand why the content-type expected is application/json; charset=utf-8 instead of application/json

dareid commented 7 years ago

Without knowing what your server is responding with, it makes it hard to replicate this. Could you produce an example showing the problem which I could replicate?

From the look of the error message your server is responding with application/json; charset=utf-8 which does not match your header expectation saying it should be returning application/json, hence the error

dareid commented 7 years ago

I am going to close this due to inactivity