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

Document how to send request body, headers, etc #23

Closed
seanaye opened this issue Jul 8, 2021 · 1 comment · Fixed by #24
Closed

Document how to send request body, headers, etc #23

seanaye opened this issue Jul 8, 2021 · 1 comment · Fixed by #24
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@seanaye
Copy link
Contributor

seanaye commented Jul 8, 2021

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:

  • deno 1.11.5 (release, aarch64-apple-darwin)
  • v8 9.1.269.35
  • typescript 4.3.2
  • SuperOak Version: 4.3.0

Details

Please replace this quote block with the details of the feature / bug you wish
to be addressed. If it is a bug please do your best to add steps to reproduce.

@asos-craigmorten asos-craigmorten added the documentation Improvements or additions to documentation label Jul 8, 2021
@asos-craigmorten
Copy link
Collaborator

asos-craigmorten commented Jul 8, 2021

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants