question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

post request work in android but not in IOs.

See original GitHub issue

Bug description:

I have a application with a webview, this webview have a post request, the webview works in android and get the page, but when i try in IOs does not work.

You can visualize the token in console, and the uri

the exception occurs in postman when the token is invalid, but it is not invalid because it works in postman and android.

The page not is mine

Expected behavior: Show the page in IOs same to android.

image

The code

            <WebView
            
            nativeConfig={{props: {webContentsDebugginEnabled: true}}}
            source={{uri: navigation.getParam('uri'), method: 'POST', body: `token=${navigation.getParam('token')}`}}
            injectedJavaScript={injectedJavascript}
            onMessage={() => this.props.navigation.navigate('Main')}
            startInLoadingState={true}
            >
            </WebView>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

25reactions
celciusjjcommented, Oct 15, 2019

i solve this error with

I’ve faced that bug too. Here is a workaround that worked for me :

headers: { ‘Content-Type’: ‘application/x-www-form-urlencoded’, }

0reactions
MatteoMarkcommented, Jun 10, 2021

@Wsm2018 Hello, you have to add it to the “source” parameter, not as a parameter itself. For instance:

<WebView
	source={{ uri: "www.google.it", method: 'POST', body: request_body, headers: { 'Content-Type': 'application/x-www-form-urlencoded', }}}
	javaScriptEnabled={true}
	originWhitelist={['*']}
	onMessage={(event) => method()}
....

Hope this helps

Read more comments on GitHub >

github_iconTop Results From Across the Web

post request work in android but not in IOs. · Issue #953 - GitHub
I have a application with a webview, this webview have a post request, the webview works in android and get the page, but...
Read more >
post request work in android but not in iOS - Stack Overflow
I have a react native application with WebView , the WebView have a post request. The WebView works as expected in android and...
Read more >
[Solved]-Ionic - HTTP POST Request not working in iOS, but ...
Coding example for the question Ionic - HTTP POST Request not working in iOS, but working in Android and Web.
Read more >
How to set a Post Request Using Postman API for Android ...
Working with Postman Requests to execute API's: ... 1. Download Postman and install on Android, Windows or Mac OS. ... 2. Create New...
Read more >
Android: POST requests data sent to server are empty with ...
The request arrives to the server but the data send via POST requests are empty the req.body is always empty when making a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found