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

How to post raw data as JSON #14

Open
thamizh82 opened this issue Mar 19, 2018 · 2 comments
Open

How to post raw data as JSON #14

thamizh82 opened this issue Mar 19, 2018 · 2 comments
Labels

Comments

@thamizh82
Copy link

Hi,

I need to post raw JSON data in fetch api without using JSON.stringify() in body.

@Exilz
Copy link
Owner

Exilz commented Mar 20, 2018

Hi,
I haven't tried it, but you should be able to do it like this

        api.fetch(
            'yourService',
            {
                fetchOptions: {
                    body: yourJsonData
                }
            }
        )

fetchOptions basically allows you to tweak the final request options with all the configuration you'd use when using react-native's fetch directly. So this shouldn't be tied to react-native-offline-api.

@Exilz Exilz added the question label Mar 20, 2018
@thamizh82
Copy link
Author

In my case fetch method appends utf8 like this "application/json; charset=utf-8".
how to solve this by not appending utf8.

Thanks

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

No branches or pull requests

2 participants