1

when I use Postman tool to test my request GET, everything is working when I check 'application/x-www-form-urlencoded' in Body settings

But when I use Axios, I feel that my settings are not taken into account! Because I have the following error "the user does not exist"

axios({ method: 'get', url: `${baseURL}/api/collect/getSante`, params: { lastName: 'value' }, headers: { 'content-type': 'application/x-www-form-urlencoded;charset=utf-8' } }) 

I expect json response but I have "the user does not exist"

1
  • Try without the 'Content-Type' header Commented Aug 18, 2019 at 15:36

1 Answer 1

2

Maybe you could try using URLSearchParams for application/x-www-form-urlencoded. F.e. :

const params = new URLSearchParams(); params.append('param1', 'value1'); params.append('param2', 'value2'); axios.post('/foo', params); 

Source: https://github.com/axios/axios#using-applicationx-www-form-urlencoded-format

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.