Unable to post through axios, trailing slash posting two request incorrectly

Viewed 1358

I am using axios to post to my token based auth endpoint like this:

 axios.post("http://SOMEAPI/PROJECT/token",
        {
            username: "SA",
            password: "123",
            type: "WT",
            grant_type: "password"
        }
    ).then(function (response) {
        console.log('Login output', response.data)
    });

This will give me 400 Bad Request

If I add a "/" at the end of url it will post 2 request from AXIOS. 1 will be for options and 2nd will be post which will not work since my project api doesn't have any project/token/ endpoint.

0 Answers
Related