request method 'get' code example

Example 1: 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;
},

Example 2: http response methods

resource HTTP response method is made up of three
components:
Response Status Code ==> 200, 301, 404, 500
(these are the most common ones)
Response Header Fields ==> Date, Server, LastModified, Content-Type
Response Body ==> This is the data that comes
back to the client from the server.