0
  let email=values.email;
let password=values.password;
let input = {
        'email': email,
        'password': password
    };

    axios({        
         headers: {
            'Content-Type': 'application/json; charset=utf-8'
         } ,          
        method:'POST',
        url: "http://localhost:3001/user/login",
        data:{
            'email': email,
            'password': password
        }
    }).then(function (response){
        console.log(response);

    })
    .catch(function (error) {

    });

So why it show OPTIONS on request method when we use header Centent-type: application/json

enter image description here

Ah Hea Sk
  • 1
  • 1
  • 1

1 Answers1

0

This is not exactly your request, but a request that every browser makes before sending your actual request to ask the server if it can respond to this kind of requests.
Note that this happens when you make a CORS request with POST or PUT method, but not with GET method.

You can see a better explanation here

Mark E
  • 3,040
  • 1
  • 19
  • 32