All Questions
Tagged with react-native axios
1,533
questions
255
votes
4
answers
450k
views
Axios get in url works but with second parameter as object it doesn't
I'm trying to send GET request as second parameter but it doesn't work while it does as url.
This works, $_GET['naam'] returns test:
export function saveScore(naam, score) {
return function (...
86
votes
8
answers
137k
views
Axios: chaining multiple API requests
I need to chain a few API requests from the Google Maps API, and I'm trying to do it with Axios.
Here is the first request, which is in componentWillMount()
axios.get('https://maps.googleapis.com/...
68
votes
2
answers
215k
views
Using Axios GET with Authorization Header in React-Native App
I'm trying to use axios for a GET request with an API which requires an Authorization header.
My current code:
const AuthStr = 'Bearer ' + USER_TOKEN;
where USER_TOKEN is the access token needed. ...
50
votes
17
answers
47k
views
Calling locally hosted server from Expo App
I am creating a react-native app and one of the components I have created contains a property which is populated through data coming from an http request.
Right now I am hosting the server from my ...
42
votes
17
answers
184k
views
Network error with axios and react native
I have created an API endpoint using the Django python framework that I host externally. I can access my endpoint from a browser (mydomain.com/endpoint/) and verify that there is no error. The same is ...
40
votes
13
answers
109k
views
Axios (in React-native) not calling server in localhost
I'm building a really easy api and react-native application. The server works well (tested with PostMan) but the application doesn't call the server. It blocks when axios has to send the post request ...
18
votes
7
answers
50k
views
How to integrate AbortController with Axios and React?
The Abortcontroller signal is not working for me with Axios in React.
I wanted to replace CancelToken (as it's deprecated) with the AbortController, but it is not working, respectively the requests ...
18
votes
8
answers
49k
views
Network Error when use axios in React Native
This is long-standing problem for me and I can't find solution at all.
Within my react native project(react-native-cli), I send request to server using axios package.
But when I'm testing with my ...
18
votes
2
answers
18k
views
Axios error Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream
I'm getting this error when trying to do a POST request using axios:
Error: Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream at createError
Here's my request:
async ...
17
votes
19
answers
32k
views
request formData to API, gets “Network Error” in axios while uploading image
I am making a POST request to server to upload an image and sending formdata using axios in react-native. i am getting "Network Error". i also try fetch but nothing work.using react native image ...
17
votes
5
answers
52k
views
react native post form data with object and file in it using axios
so i want to upload
object as data
and file as Note
to api using axios
uploadToServer= () => {
const file =this.state.photo
let data2 ={sale_id:1,
note_type_id:4,
...
17
votes
2
answers
65k
views
Check Axios request url before sending
API requests are failing because the URL generated by Axios is incorrect due to my config. I know what the request url is suppose to look like, so I want to see the request url Axios generates.
I can ...
17
votes
1
answer
8k
views
React Native and Https Agent
Is possible use HTTPS Agent in React Native app?
My code right now is:
import axios from 'axios';
import ip from './ip';
import https from 'https';
const httpsAgent = new https.Agent({...
16
votes
1
answer
22k
views
Prevent axios/fetch redirection
I have a little problem with my app:
I have to get some cookies given in the response of one URL, which is obtained by making a request to another URL. The request is done, but I'm not able to get the ...
13
votes
3
answers
10k
views
Create Axios instance with taking token from AsyncStorage
In my React Native App, I want to create an Axios instance to send headers to the backend with a token taken from AsyncStorage. However, the following Token() always returns an object( Promise ) ...
13
votes
2
answers
24k
views
Network error with axios and android emulator
I got a React-Native application working with a NodeJS backend which serves an API.
My React-Native front is using Expo and Axios to hit on a route of my NodeJS API (using Hapi, Joi, Knex), which ...
12
votes
2
answers
20k
views
Mock Postman request into Axios?
I'm trying to construct my axios to be able to mimic the postman request but failed. Please help to have a look
const ax = axios.create({
timeout: 30000,
headers: {
'content-type': '...
11
votes
2
answers
16k
views
Header keys become lowercase when interacting with API - React native
When interacting with API, the custom Header key always become lowercase. I'm use Fetch, Axios, XMLHttpRequest and Frisbee (javascript network library) but the key always lowercase
My snippet code ...
11
votes
0
answers
2k
views
Disable axios redirects in react-native
I'm currently developing an react-native app that authenticates using a server that returns an 302, and a location redirect in the response header. But I need an variable that inside the location ...
10
votes
3
answers
19k
views
Axios is caching somehow my get user request react native
I'm using Axios ("axios": "^0.19.0") to do a GET request to my backend which works as I already tested it by sending the same token through Postman macOS app, and returns the correct user object.
...
10
votes
1
answer
9k
views
Axios Promise Handling - Getting "Possible Unhandled Promise Rejection - TypeError: Network request failed" in react-native
In my react-native application on the login screen I'm working on providing the user with nice error messaging after entering in the incorrect username / password combination. To interact with the API ...
10
votes
1
answer
1k
views
Axios returns only last "set-cookie" if there are multiple
I'm using axios in my react-native app to call rest api. in response to api call, server returns multiple 'set-cookie' headers. But axios returns only the last one.
Tried the same API in Postman, ...
10
votes
0
answers
5k
views
How to ignore SSL issues in axios using React Native?
Hi I'm currently working with react native on Android with Expo. I am trying to send requests to my server which has a valid ssl certificate, but for some reason axios takes it as invalid, so axios ...
9
votes
2
answers
11k
views
How to use react-redux to store a token and use it on multiple axios request?
I am building an app using react native that requires me to do multiple get request on same API with token.
Let say the URL is like this:
Token URL = https://test.co/v1/tokens, API URL 1 = https://...
9
votes
2
answers
3k
views
React Native Axios get response Skipped and Status Code 0
I got a problem with my react native app. while accessing API, I get a response Skipped and status code 0. it's shown by using reactotron to log the api response, but when I console.log the error, it ...
9
votes
1
answer
10k
views
Handling Refresh Token in React Native
I have an app authenticating fine and returning the access_token and refresh_token. I store them with AsyncStorage and save/get the access_token with redux. This is the very first app I am building ...
9
votes
0
answers
2k
views
React native IOS :axios/fetch request stuck with no error or no response on IOS only
Description:
sending a request with Axios or fetch in IOS not work and it doesn't matter if the API is HTTPS or HTTP
no error reaches the catch or no response received
also no errors, only warnings ...
8
votes
3
answers
14k
views
Call localhost API within react native ( android device : connected through local)
Have created a simple GET API using node.js and trying to consume it within my expo-react native project using axios/fetch.
The GET API is called whenever user clicks on submit button.
Submit -> ...
8
votes
1
answer
6k
views
React Native Axios allow self signed ssl certificate
I'm writing an app in React Native, and I need to make API requests. The server for that is running on a server with a self-signed SSL certificate, so I need Axios and React Native to make the request ...
8
votes
1
answer
2k
views
Require cycle while requiring store in axios
In a reactive native application which is using a redux-saga architecture plus axios, I want to intercept 401 requests and dispatch an action which sends me to a login screen.
So in my axios client, ...
8
votes
1
answer
2k
views
Axios image upload using post form data always returns network error
Having problem uploading an image on android running react native using axios. I have researched a lot about this and have tried a lot of things for the past 3days but no solution yet.
This seem to ...
7
votes
6
answers
25k
views
React Native - Axios - Trying to upload image
I am new to React Native and trying to upload Image with Axios but getting: Request failed with status code 500
I don't have backend problem because I can upload image with postman and everything is ...
7
votes
1
answer
28k
views
Possible Unhandled Promise Rejection Network Error in React Native
I setup my local server using express.js, That simply handle request and return simple message.
app.get('/hello', (req, res) => {
res.send('Hello world !');
});
I executed server and test it ...
7
votes
3
answers
16k
views
How to Check if Axios Call Fails due to No Internet Connection?
I'm trying to figure out an accurate way to detect axios call failure due to no internet connection.
Does axios call failure return a specific response object or specific response status code or ...
7
votes
5
answers
14k
views
React Native Axios request on iOS returns "Network Error"
I created a RN project (without Expo) and setup my API services. I'm using dummyapi.io to get dummy post data, which is a HTTPS request. I keep getting "Network Error" from Axios and when I ...
7
votes
1
answer
39k
views
Get API data with POST method in react-native with axios
I need to get data in react-native app with axios. I can get data with simple GET method as below:
class AlbumList extends Component {
state = { albums: [] };
componentWillMount() {
//axios.get(...
7
votes
2
answers
20k
views
Detect and handle slow internet connection in React-Native
Currently I am using NetInfo of react-native and with the help of EffectiveConnectionType, I am able to find the connection is in :
2g, 3g, 4g and unknown. But is there any optimise way to handle this ...
7
votes
1
answer
4k
views
Image Upload with React Native, Expo ImagePicker, Rails, Axios and Paperclip
So far everything works in the backend regarding Rails and Paperclip. I have it set up so that when you create a new Post, the image within that post will be uploaded to AWS S3. It works fine on the ...
7
votes
5
answers
38k
views
Possible unhandled promise rejection, network error when using axios
I'm trying to send JSON data using react-native, axios and Expo, but when I press "Send" on my application, I get this warning:
Possible unhandled promise rejection, Error: Network Error
My API ...
7
votes
1
answer
9k
views
How do you pass body data with an Amplify REST request?
I'm using the AWS amplify REST API to make a get request to my lambda function in React Native. The API/Lambda function was generated by the Amplify CLI.
const getData = async (loca) => {
...
7
votes
3
answers
10k
views
java.security.cert.CertPathValidatorException: Trust anchor for certification path not found in React-Native [duplicate]
I am building an app in react-native and using axios package for post request. I get the error when axios post request in react-native android app. SSL certificate is signed with letsencrypt.
Https ...
7
votes
3
answers
83k
views
axios get request return request failed with error 400
I need help on solving this issue. I am new with react native and javascript. Now I am trying to hook up the react native application with API. This process require me to get the token first by axios....
7
votes
0
answers
1k
views
how to disable SSL in react native expo in fetch or axios API call
I am trying to disable SSL in react native expo
here is what I have tried
import * as https from "https"
const agent = new https.Agent({
rejectUnauthorized: false,
});
let response = ...
7
votes
1
answer
13k
views
https undefined in react native axios
I have used axios for react native app but while implementing https.agent it shows https is undefined. How to solve this? My code
const instance = axios.create({
httpsAgent: new https.Agent({
...
6
votes
1
answer
4k
views
Axios interceptors - Not using instance until AsyncStorage resolved?
I've an Axios Interceptor setup to manage responses and cut down on re-writing code everywhere. Currently, I need to add the Authorization header using the { config } object in each call like below.
...
6
votes
2
answers
15k
views
Axios post request with header not working
I have used axios for calling network request in react-Native but it return 500 response code.
Note: It's working perfect in postman client.
Authorization Token:
Bearer ...
6
votes
4
answers
7k
views
React Native + Expo + Axios file upload not working because axios is not sending the form data to the server
I am trying to upload an image with react native front end and axios to my back end.
This is how pic the image
const pickImage = async () => {
let result = await ImagePicker....
6
votes
3
answers
8k
views
Android issue uploading image to server using Axios in React-Native App
I am getting the following network error when attempting to upload/POST an image from Android. Works perfectly on iOS. Works perfectly on Android when no image included in FormData.
export function ...
6
votes
2
answers
14k
views
Axios POST request sending nothing with 'multipart/form-data' [React Native - Expo]
Scenario
Front end is basically a React Native (Expo) application where users can issue a report - this includes taking multiple photos and filling in some details.
Backend is just node.js, with ...
6
votes
1
answer
4k
views
How to display a "content-type: image/jpg" response from the API? (React Native) [duplicate]
I'm posting an image, and getting the processed image as a response from the backend. The problem is with the response part. I can't display the image whatever I do.
First of all, Postman works. So ...