.put() does not work as expected
Opened this issue · 1 comments
MaxGfeller commented
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 commented
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)