Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

548
Visualizações
Axios request in Expo React Native app returns unexpected 405 error

I'm developing a React Native app with Expo and I'm using Axios to try sending http requests. Unfortunately, for every request I get a 405 status response.

This is the axios instance I've created to manage the requests (API url replaced with dummy for security reasons):

    import axios from 'axios';

    const instance = axios.create({
        baseURL: 'https://actualapi.com',
        headers: {
            ['Content-Type']: 'application/json',
            'Access-Control-Allow-Origin': '*',
            'Access-Control-Allow-Methods': '*'
        }
    });

    export default instance;

The actual request (in a redux thunk function aka async action creator):

    axios
        .post(
            requestPath,
            // { withCredentials: true },
            { email: email }
        )
        .then((res) => {
            console.debug(JSON.stringify(res));
            checkEmailSuccess(res);
        })
        .catch((error) => {
            console.debug(error);
            checkEmailFail(error);
        });

The error for every single request:

Request failed with status code 405
at node_modules\axios\lib\core\createError.js:16:14 in createError
at node_modules\axios\lib\core\settle.js:17:22 in settle
at node_modules\axios\lib\adapters\xhr.js:66:12 in onloadend
at node_modules\event-target-shim\dist\event-target-shim.js:818:20 in EventTarget.prototype.dispatchEventat node_modules\react-native\Libraries\Network\XMLHttpRequest.js:614:6 in setReadyState
at node_modules\react-native\Libraries\Network\XMLHttpRequest.js:396:6 in __didCompleteResponse
at node_modules\react-native\Libraries\vendor\emitter\_EventEmitter.js:135:10 in EventEmitter#emit       
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:414:4 in __callFunction
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:113:6 in __guard$argument_0
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:365:10 in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:112:4 in callFunctionReturnFlushedQueue
about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

It was a wrong call. I was doing a POST instead of GET.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda