put request with axios code example

Example 1: how to make request with axios

const axios = require('axios');

async function makeGetRequest() {

  let res = await axios.get('http://webcode.me');

  let data = res.data;
  console.log(data);
}

makeGetRequest();

Example 2: axios put

const res = await axios.put('https://httpbin.org/put', { hello: 'world' });

res.data.headers['Content-Type']; // application/json;charset=utf-8

Example 3: axios put request

const res = await axios.put('https://httpbin.org/put', { hello: 'world' });

res.data.headers['Content-Type'];

Tags:

Misc Example