React Native: Set Headers With The Linking Api
How can I setRequestHeader in React Native? Like the following: var client = new XMLHttpRequest(); client.open('GET', 'http://www.example.com/api'); client.setRequestHeader('author
Solution 1:
to make request with headers to website, you need http(s) request, not linking between 2 apps.
As mentioned in other answer, linking api does not have headers. While fetching remote address with http(s) do have headers
https://facebook.github.io/react-native/docs/network.html
fetch('https://mywebsite.com/endpoint/', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
firstParam: 'yourValue',
secondParam: 'yourOtherValue',
})
})
Solution 2:
The Linking API is for linking between apps on the device. There is no notion of headers when linking between apps. Use query parameters in the URL instead.
Post a Comment for "React Native: Set Headers With The Linking Api"