Skip to main content

Axios example

Just three lines of code, as highlighted in the snippet below, are all it takes to integrate mockforme.

mockforme with axios


import { mockforme } from 'mockforme';

const TOKEN = 'ACCESS_TOKEN';
mockforme(TOKEN).run();

const headers = {};
headers['Content-Type'] = 'application/json';
return axios({
method: 'get',
url: '/user/getSession',
headers: Object.assign({}, headers),
data: {},
});