Check Axios request url before sending

axios get request with params
axios post json body
axios typescript
axios content-type
axios get html response
axios cheat sheet
axios put request react
axios get response headers

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 point Axios to my local server and see the requests there, but I want to debug this on the client. I want to play with the config, and see how the requests change. Is there a way to output the request url from Axios before or after sending?

// param format
{ address: 'Vancouver', key: GOOGLE_API_KEY }

// Geocode sample,+Mountain+View,+CA&key=YOUR_API_KEY

_request = async (...args) => {
  const { outputFormat, params } = args
  const instance = axios.create({
    baseURL: ``,

  const response = await instance.get('/maps/api/geocode/${outputFormat}?', {

  // I want to see the url generated by Axios so I can debug the issue


I am within the Expo, React Native environment.

Working example using fetch:

const url = `${GOOGLE_API_KEY}`

  .then((response) => response.json())
  .then((data) => {
  .catch(function(error) {

Solution used:

_request = async (obj) => {
  const { outputFormat, params } = obj

  const instance = axios.create({
    baseURL: ``,

  instance.interceptors.request.use(function (config) {
    return config
  }, function (error) {
    return Promise.reject(error)

  const response = await instance.get(`/maps/api/geocode/${outputFormat}`, {

You can turn on debug mode and look at the network tab as mentioned in the other answer, or you can intercept axios and console.log or do whatever you want with the request before it's sent:

axios.interceptors.request.use(function (config) {
    // Do something before request is sent
    return config;
  }, function (error) {
    // Do something with request error
    return Promise.reject(error);

axios/axios: Promise based HTTP client for the browser and , Send a POST request axios({ method: 'post', url: '/user/12345', data: to the request data before it is sent to the server // This is only applicable for request  { // `url` is the server URL that will be used for the request url: '/user', // `method` is the request method to be used when making the request method: 'get', // default // `baseURL` will be prepended to `url` unless `url` is absolute.

You can just use axios#getUri([config]) (source) to perform the same logic as the request. It merges the configurations (e.g. the given config and the instance configuration), merges the url with the baseURL, and appends any params using the paramSerializer.

Axios Cheat Sheet, send a POST request axios({ method: 'post', url: '/login', data: As an example, here's how the response looks when requesting data from the GitHub API: So be sure to check out the Axios GitHub page to learn more. This should look familiar to those who have worked with jQuery’s $.ajax function. This code is simply instructing Axios to send a POST request to /login with an object of key/value pairs as its data. Axios will automatically convert the data to JSON and send it as the request body.


Chrome-console > Network tab

There you will find all informations about your requests send by javascript

How to make HTTP requests like a pro with Axios, Axios is a very convenient JavaScript library to perform HTTP Check out this video where I create an Express server that offers a POST axios({ url: 'https://​', method: 'get', data: { foo: 'bar' } }). axios post request to send form data. axios POST request is hitting the url on the controller but setting null values to my POJO class, when I go through developer tools in chrome, the payload contains data.

HTTP requests using Axios, Axios makes it easy to send asynchronous HTTP requests to REST When we send a request to a server, it returns a response. const axios = require('axios'); async function makeRequest() { const config = { method: 'get', url: 'http://webcode.​me' } let res = await axios(config) We verify the sent data. A custom route loader to generate url's following REST conventions; Accept header format negotiation including handling for custom mime types; RESTful decoding of HTTP request body and Accept headers; Exception controller for sending appropriate HTTP status codes

HTTP requests in Node using Axios, to check the response status code to determine if the request was successful. Axios, on the other hand, will reject the request promise if one of these status codes is returned. send cookies back to the server when making a request. URL you use. headers : an object of key/value pairs to be sent as  Experiencing the above issue with the latest axios version - using the shorthand methods to specific request types results in ignoring the auth parameters and ends with a failed Basic Auth strategy. I'm using Express + Passport on the server side and Axios within the client.

Axios tutorial - GET/POST requests in JavaScript with Axios, Let us start with a small task and sending one request using Axios itself. First, we import axios and define the API/URL we want to load from. the quick answer is that first argument after url and second is often misplaced, i.e. axios(url, data, config), so if you omit config part or switched data and config you probably get unexpected results, in general, working with localhost should be without any issues at all. In general, it it not very readable. axios.request(config)