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

.put() does not work as expected #57

Open
MaxGfeller opened this issue Nov 20, 2013 · 1 comment
Open

.put() does not work as expected #57

MaxGfeller opened this issue Nov 20, 2013 · 1 comment

Comments

@MaxGfeller
Copy link

This is a little test suite i use to test a simple API:

var APIeasy = require('api-easy');

var suite = APIeasy.describe('API');

suite.use('localhost', 3000)
    .path('/users')
    .get()
        .expect(200)
    .next()

    .put({ firstName: 'Testibus', lastName: 'Testman' })
        .expect(200)

    .export(module)

However, the .get() works as expected but the .put() results in an error:

    A PUT to /users
      ✗ should respond with 200
        » expected 200,
    got  undefined (==) // api-easy.js:290
  ✗ Broken » 1 honored ∙ 1 broken (0.304s)

Am i missing something?

@alexhornbake
Copy link

This comment is pretty old... but came across the same issue. Explicitly setting Content-Type in header resolved it. For example:

suite.use('localhost', 3000)
    .path('/users')
    .setHeader('Content-Type', 'application/x-www-form-urlencoded')
    .put({ firstName: 'Testibus', lastName: 'Testman' })
        .expect(200)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants