“Axios.Headers.Common” Kode Jawaban

header di Axios.get

const axios = require('axios');

// httpbin.org gives you the headers in the response
// body `res.data`.
// See: https://httpbin.org/#/HTTP_Methods/get_get
const res = await axios.get('https://httpbin.org/get', {
  headers: {
    'Test-Header': 'test-value'
  }
});

res.data.headers['Test-Header']; // "test-value"
Courageous Cat

Axios.Headers.Common

// Set authorization headers on axios
axios.defaults.headers.common['Authorization'] = AUTH_TOKEN;
Witty Wasp

header default aksios umum

// GET request for remote image
axios({
  method: 'get',
  url: 'http://bit.ly/2mTM3nY',
  responseType: 'stream'
})
  .then(function(response) {
  response.data.pipe(fs.createWriteStream('ada_lovelace.jpg'))
});
Tame Toad

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya