Test agent is not setting defaults for requests
The agent returned by supertest doesn't apply the saved settings when a request is made:
const supertest = require('supertest')
const request = supertest.agent(app)
.set('Content-Type', 'application/json')
const ret = await request.post('/some/api').send('{"some": "JSON"}')
// body is not read as json at the API
It's because there's a line missing that calls the this._setDefault(req) method in the Test Agent
I have this fixed.
I just need to write a test for it before creating a pull request.
Hello @bdharrington7 & @ozzywalsh,
Thanks for using this package. @ozzywalsh, I'm waiting for you pull request. 🚀
Hi @rimiti, The PR has been made almost a month ago (still waiting to be merged), when is the next release?
@rimiti As you're still actively making releases, it would be nice if this made it in to the next one :)
Thanks @ozzywalsh and @bdharrington7 for your contribution. This nice feature has been merged and released:
https://github.com/visionmedia/supertest/releases/tag/v4.0.0
🚀