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

http: It's too hard to POST JSON #922

Open
josephjclark opened this issue Jan 17, 2025 · 1 comment
Open

http: It's too hard to POST JSON #922

josephjclark opened this issue Jan 17, 2025 · 1 comment
Assignees
Labels
adaptor Related to one of the adaptors Easy Complexity level enhancement New feature or request P3 Priority Level

Comments

@josephjclark
Copy link
Collaborator

It took me like 5 minutes to post a JSON object to a server with HTTP post.

It shouldn't be so hard!

Where I went wrong is:

  • The signature is `post(path, params, callback).
  • Params should be called options , because 'we not defining URL query params
  • The body goes in params.body. Why not post(path, body, options) ?
  • I have to specify a content type application.json. Why doesn't the adaptor do this for me?

To be fair we do document the content type thing:

Image

I don't remember why we don't auto-parse an object 🤔 Feels like the natural thing to do. We should log to say we're doing it, and handle errors well.

I suggest:

  • Rename params to options
  • Either auto-detect content type, or just default to json, unless the content-type header is set
  • Update the signature when we do our next major version bump
@aleksa-krolls
Copy link
Member

@hunterachieng adding new issues to your Ready backlog. Please add estimates before getting started, and sync with Joe if you need to align on the approach.

@hunterachieng hunterachieng added enhancement New feature or request adaptor Related to one of the adaptors labels Feb 4, 2025
@martalovescoffee martalovescoffee added Medium Complexity level P3 Priority Level Easy Complexity level and removed Medium Complexity level labels Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adaptor Related to one of the adaptors Easy Complexity level enhancement New feature or request P3 Priority Level
Projects
Status: New Issues
Development

No branches or pull requests

4 participants