I have an end point that accept username as query string but this username might have # in the beginning so in Joi I got this
{
"code": 1021,
"message": "Request data model validation has failed",
"id": "276ba99a-2abc-4505-b66a-dad2a8ger5",
"explanation": [
"`username` is not allowed to be empty"
]
}
how can I make my query string accept # in the beginning using Joi?
You have to encode your param before adding it to the URL.
const url = 'https://example.com?username=#allia';
const response = await fetch(encodeURIComponent(url));
Or you can replace #
by %23