Make postman query param type of boolean

2178 views javascript

I use postman to test my api


I want to set disabled=true (or false) and I expect it is a bool

But somehow

const {disabled} = req.query;
console.log(typeof disabled) //I get disabled type of string

How I set my query param boolean type?

answered question

Have you tired to set disabled to 1 or 0 ?

It still shows that type of disabled is string

Just asking, won't it work with a boolean? like let condition = disabled==='true'?

1 Answer


Regardless of the format (query params, JSON body) it is the job of the backend to parse and validate the request.

So even if you send a parameter like “active=true”, it is still a string, this is how the HTTP protocol works.

For more info --->

posted this

Have an answer?


Please login first before posting an answer.