Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 04:04
    wafuwafu13 edited #3791
  • 02:32
    wafuwafu13 synchronize #3791
  • 02:01
    wafuwafu13 synchronize #3791
  • 01:40
    wafuwafu13 opened #3791
  • May 09 14:36
    paritosh-yadav commented #2073
  • May 09 10:42
    santicastro labeled #3790
  • May 09 10:42
    santicastro opened #3790
  • May 08 23:09
    mgabeler-lee-6rs commented #3771
  • May 08 19:36
    github-actions[bot] closed #3789
  • May 08 19:36
    github-actions[bot] commented #3789
  • May 08 19:36
    lvillacin labeled #3789
  • May 08 19:36
    lvillacin opened #3789
  • May 08 02:20
    Rc85 edited #3788
  • May 08 02:19
    Rc85 opened #3788
  • May 08 02:19
    Rc85 labeled #3788
  • May 08 02:18
    Rc85 edited #3787
  • May 08 02:12
    Rc85 edited #3787
  • May 08 02:12
    github-actions[bot] closed #3787
  • May 08 02:12
    github-actions[bot] commented #3787
  • May 08 02:11
    Rc85 opened #3787
Konstantin Bläsi
@konstantinblaesi
maybe you're not using the same node version locally as in aws
Andrey Doroschenko
@dorosch
Screenshot from 2020-07-03 11-23-49.png
Screenshot from 2020-07-03 11-24-04.png

Hi guys
Could you help me? I tried to make a request with axios but axios ignore header Set-Cookie.

Here's instance of axios:

const API = axios.create({
  withCredentials: true,
  baseURL: 'http://0.0.0.0:8000/api/v1'
})

And attach some screens for proofs. Axios ignore headers about cookie and doesn't store cookie in local storage.

1 reply
Manikanta
@sai1139
hi
i'm creating the the feature request in github.it was closing automatically does not follow the issue template.
can anyone help
Donavan Becker
@donavanbecker
Just wondering if there is away to see what the a ‘get’ or ‘post’ sends? I am just getting a 400 error.
Ashokkumar
@Ashokkumar93
how should I delete Accept-Encoding or set Accept-Encoding: null on request
xhr.js: Refused to set unsafe header "Accept-Encoding"
Yuba Raj Khadka
@yubi00
hi everyone, can anyone help me?
here is my issue
unfortunately, no one replied there
just wondering, if this is a problem related with proxy or somthing else
Moritz Bischof
@NyxCode_gitlab
Hey, axios 0.20 just broke my app.
This line, which previously worked, has no effect now:
axios.defaults.baseURL = '/api'
what's happening here? everything worked in 0.19
Moritz Bischof
@NyxCode_gitlab
yeah, wtf is going on here. only related thing i found in the changelog is axios/axios#2391, but i dont know
just tested, everything's fine on 0.19
Jonas Amundsen
@badeball
Hi! My impression is that axios doesn't by itself attempt to store cookies received and use them for consecutive requests, is this true?
This is in a node-environment
~gautham~
@gauthamilango_twitter
Hello!
I have an issue with Axios. I am working on a React Native project. We are using Axios to make the network calls. Whenever we try to make network call after changing the date and time to past, like six months back via android devices Date & time settings, Axios throws a Network error
How can we fix it?
quanganhtran
@quanganhtran
good morning! is there any breaking change in 0.20.0?
I want to update but im not sure if breaking changes are marked as such
Prashant Singhal
@PrashantSinghal619
Hi everyone,
I am creating an instance of Axios (let's sat client) and providing some custom config to it.
Now when I call client().get('/api/endpoint'), is there a way to extract the URL provided to get() inside the client function implementation in which I do the job of creating an Axios instance? I want to check something based on URL parameter criteria.
Here's my implementation of client():
import Axios from 'axios';
import { apiBaseUrl } from '../constants/configuration';

const TYPE_JSON = 'application/json';

export const buildAPIInstance = ({ contenttype = TYPE_JSON }) => {
  const objAxios = Axios.create({
    baseURL: apiBaseUrl,
    headers: {
      common: {
        Accept: TYPE_JSON,
        'Content-Type': contenttype
      },
      post: {
        'Content-Type': TYPE_JSON
      }
    }
  });

  return objAxios;
};

const client = (params = {}) => buildAPIInstance(params);

export default client;
Prashant Singhal
@PrashantSinghal619
nevermind, found it
for anyone willing to know the solution, here it is:
I used axios.interceptor API like this:
objAxios.interceptors.request.use(config => {
  if (config.url) {
    // do something
  }
})
José Valente
@JFDValente
Hello friends, you need your help, I am configuring timeout for my request, but it is not applied in OPTIONS requests, does anyone know why? const bffClient = axios.create({ baseURL: <URL>, timeout: 5000, });
Pavel Severov
@pavelseverov

Hi, axios v.0.21.0 causes node.exe to silently crashing, without possibility to catch the exception. Occurs with node.js v.14.15.0 (current LTS Version, recommended for most users). Earlier or later versions works Ok (I have tested v.9.11.1 and v.15.1.0)

Effect is not stable and not easy to be quickly reproduced, appears mostly on bad/slow internet connections. Most probably because of “connect ETIMEDOUT”, but this is only my guessing, because node.exe just unexpectedly terminates, without any additional info.

Please recommend – should it be reported as a bug to https://github.com/axios/axios/issues/ or not?

This is the code for reproducing the problem (actually nothing special, just continuously getting lots of data). Tested on the Windows 10 1909.
MyApi is url/config of service-now.com REST API. Unfortunately I can’t share it.

var axios = require('axios');
let n=1;
test();
async function test() {
  do {
    await axios.get(MyApiUrl,MyApiConfig)
      .then(res => console.log(n++, "got "+JSON.stringify(res.data).length+" bytes (node.js "+process.version+")"))
      .catch(err => {console.error("ERROR: "+err.message);process.exit()})
  } while (true)
};
avi12
@avi12
Hey, I need some help:
I'm using Electron, and I need to download a file while using the renderer process, as well as display the progress and allow the user to cancel the download.
How can I achieve this with Axios?
Nick Medrano
@dosstx
hello, i am new to axios and http requests in general, i want to make sure i understand this correctly:
I have an app that uses localStorage for storing tokens. I am using axios to consume protected data. I have the axios header auth set to the bearer token received from an authorization server (SSO). So, if the user is authenticated, axios will give him the sensitive data. I am using localstorage to check if token exists, if no token, then i redirect user to login screen to start the auth process so he can get an access token. However, i'm a litte weary when using localStorage.getItem because can't someone just delete and add a new fake token in localstorage? I guess the key is this: Every axios request is sending the authorization header with bearer token. So, if a malicious user tries to add a fake token, he needs to match the exact secret key that is in the valid token in order to make a successful data request. Is my undertanding correct and I have no real worry here? Thank you!
Jack Holloway
@jackhollowaypersonal_gitlab
Hey all. I've got a project I'm working on, been doing it both on MacOS and Windows. My project is working fine on Windows, and when I pull to MacOS (Important part here, is Apple Silicon and it's running on Rosetta) - my HTTP Post call is getting a 400 error. When running the same project on Windows, it works fine. I've tried Postman on both Mac and Windows. Works on Mac but then the same headers/body doesn't work on Axios. Works on my old Intel mac though. Any ideas? Error HTTP 400
Jack Holloway
@jackhollowaypersonal_gitlab
Wondering whether it's even worth posting here about this? Looking back, literally no one this year has been helped
Gerson Dias
@GersonDias
hello guys, after updating axios from 0.19 to 0.21.1 I figure out that none of my requests are working in Firefox (it's working on chrome and edge). Not sure how to debug that, I can't even see my request in the network tab... reverting back to 0.19.0 do the trick.... there is some breaking change between that updates?
Eric Olivas
@luckyincode
Is axios unmaintained? are folks moving to got?
Eric Olivas
@luckyincode
oof
Harry Kruger
@ha6000
when I make a post request, the response says it is a get request?
how to fix
Alexander
@TAVkiev
Hi all, may be some face it, looking for help with interceptors
I supposed it would be very easy to add simple retry, but not...
I added small function, within request I am using FormData and few additional headers.
The problem that the config within "interceptors.response" differs from the one in "interceptors.request". It does not contain FormData and headers, I guess because of streams. In any case I added "interceptors.request" jus to see what is going on with initial request config. I also tried set directly FormData and headers within "interceptors.request" config - did not help at all, config within "interceptors.response" always empty, not data, no headers...
export function retryRequest(axiosInstance, { maxCount }) {
    let counter = 0;
    axiosInstance.interceptors.request.use(function req(config) {
        return config
    });
    axiosInstance.interceptors.response.use(null, (error) => {
        const { config: originalRequest } = error;
        if (counter < maxCount) {
            counter += 1;
            return new Promise((resolve) => {
                resolve(axiosInstance.request(originalRequest));
            });
        }
        return Promise.reject(error);
    });
Haseeb Udeen
@RacketyWater7

Hi everyone, I have a quick question that: Do axios interceptors get triggered for the http calls that are made by the fetch() method instead of axios, in react js?

Let me provide a little explanation for the clarification:
Our react app is using fetch() method of window object, for the http calls in most or all of its areas. Just the http call that is made during login is an axios.post() method. Other than that, all other data fetching and updating etc. http calls are made by the fetch() method.
And I have put in the axios interceptors for the tokens authentications in our app. But they only work during the login page and not in any other page or function etc. What is causing this issue, please guide me. Thankyou
Below is the code of my axios.interceptors:

//Request Interceptor
axios.interceptors.request.use(
  async (config) => {
    console.log("I checked if it is login address");
    if (config.url.includes("/superuser/login")) return config;

    let access_token = Cookies.get("access");
    let refresh_token = localStorage.getItem("refresh_token");
    await AdminIndex.hasAccess(access_token, refresh_token);
    console.log("I came to refresh the access token");
    return config;
  },
  (error) => {
    console.log("Error is:", error);
    return Promise.reject(error);
  }
);
// Response Interceptor
axios.interceptors.response.use(
  (response) => {
    console.log("I came in response section");
    console.log("Respones is:", response);
    return response;
  },
  (error) => {
    console.log("Error is:", error);
    console.log("I came in error section");
    console.log(error.response.status);
    const originalRequest = error.config;
    if (error.response.status === 401) {
      console.log("I entered in 401 section");
      originalRequest._retry = true;
      let refresh_token = localStorage.getItem("refresh_token");
      AdminIndex.refresh(refresh_token);
      return axios(originalRequest);
    }
    return Promise.reject(error);
  }
);
Harry Kruger
@ha6000
Axios interceptors gets executed when that axios instance makes a request. It does not polute fetch or other http methods. Idk much about react, but i dont think that will change anything.
@RacketyWater7
Andrea Bertoldo
@Etchelon
hello, the README.md on interceptors says you can pass in a 3rd parameter to use(), after the 2 handlers, like { synchronous, runWhen }, but in the source code there's no trace of this... is the README outdated?!