Closed seanaye closed 3 years ago
superoak
is based on superagent
and utilises it's API - check out https://visionmedia.github.io/superagent/#post--put-requests.
E.g.
const request = await superoak(app);
await request.post("/user")
.set("Content-Type", "application/json")
.send('{"name":"superoak"}')
This is referenced in the readme: https://github.com/asos-craigmorten/superoak#api
We can look to add some more documentation / examples in the repo as well to aid discoverability.
There also appears to be a bug with the type definitions as the returned class from .post(url: string)
should have more than just expectation methods!
Issue
I cannot find any documented way of sending a post request with a body or setting custom headers on the request. According to the docs
Test.post(url:string)
there is only a url accepted. How should I set headers and post body on request?Setup:
Details