Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to check request method was a get

import axios from 'axios';

const Api = axios.create({
  baseURL: 'https://example/',
});

Api.interceptors.response.use(response => {
  if (response.data.message && response.request._method !== 'GET') {
    console.log(response.data.message);
  }
  return response;
},
 
PREVIOUS NEXT
Tagged: #check #request #method
ADD COMMENT
Topic
Name
8+7 =