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

Pass body through JSON.stringify #4

Open
iansinnott opened this issue Feb 23, 2021 · 0 comments
Open

Pass body through JSON.stringify #4

iansinnott opened this issue Feb 23, 2021 · 0 comments

Comments

@iansinnott
Copy link

Hey, thanks for writing this.

I think there may be a bug when encoding a request body. fetch doesn't like being passed an object literal for body but the generated fetch request is passed the object directly.

Some example output might look like this:

fetch('https://api.example.com/api/v2/resource', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
    },
    body: JSON.stringify({"key": "vslue"})
});

This online tool seems to be doing what I'm referring to: https://curl.trillworks.com/#browser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant