Response code:400 Response message:Bad Request code example

Example 1: error: request failed with status code 400

You should add a catch to the get call:

import axios from 'axios';
import config from './config';

axios.get('${config.serverUrl/api/contests')
  .then(resp=>{
    console.log(resp.data);
  })  
  .catch(error=>{

  });

Example 2: what is error code 400

The HyperText Transfer Protocol (HTTP) 400 Bad Request response status code indicates that the server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).

Tags:

Misc Example