`urlEncodeParameters` config ignored when using `fetch`
The output config urlEncodeParameters says it is only supported in Tanstack Query clients and that is true but it additionally only works if your httpClient is set to axios (the default). Changing httpClient to fetch makes the setting no longer do anything.
Near as I can tell, this problem was introduced in the v7.x release when fetch support was added for Tanstack Query clients. The code was split, and the original axios implementation retained the fix from #679, but the fetch implementation does not use it.
You can easily reproduce this in the playground.
- Choose the Basic example
- Find the
showPetByIdfunction inendpoints.tsand note that is not encoding thepetIdparam in the route - Add the line
"urlEncodeParameters": truetoorval.config.tsunder the"output"section - Find the
showPetByIdfunction inendpoints.tsagain and note that it now properly wrapspetIdwithencodeURIComponent, awesome! - Add the line
"httpClient": "fetch",toorval.config.tsunder the"output"section - Find the
getShowPetByIdUrlfunction inendpoints.tsand note that it does not encode thepetIdparam in the route - You can change or remove
urlEncodeParametersbut the output won't differ as the code that generates forfetchnever uses it
Seems like it just needs to be implemented for Fetch. PR is welcome.
I can give it a look tomorrow @melloware
Assigned to you thanks!