Answers for "axios response format"

4

axios response.json

const axios = require('axios');

const res = await axios.get('https://httpbin.org/get', { params: { answer: 42 } });

res.constructor.name; // 'Object', means `res` is a POJO

// `res.data` contains the parsed response body
res.data; // { args: { answer: 42 }, ... }
res.data instanceof Object; // true
Posted by: Guest on October-20-2020
0

axios

const axios = require('axios').default;

// axios.<method> will now provide autocomplete and parameter typings
Posted by: Guest on December-06-2020

Browse Popular Code Answers by Language