ahmadnassri/httpsnippet

View on GitHub
src/targets/javascript/axios/fixtures/headers.js

Summary

Maintainability
A
0 mins
Test Coverage
import axios from 'axios';

const options = {
  method: 'GET',
  url: 'http://mockbin.com/har',
  headers: {
    accept: 'application/json',
    'x-foo': 'Bar',
    'quoted-value': '"quoted" \'string\''
  }
};

try {
  const { data } = await axios.request(options);
  console.log(data);
} catch (error) {
  console.error(error);
}