Closed HenriJ closed 2 hours ago
Good point... checking why it still works...
Thank you for reporting this, @HenriJ . And for the donation. It seems that I missed the path parameters case in my tests.
In order to preserve the backwards compatibility, the suggested Implementation will use the content-type
header of the actual response instead of jsonEndpoints
dictionary.
🚀 v20.21.2, @HenriJ Thank you for the contribution
Description
The usage example in the generated client tries to find out if the response should be parsed as JSON or text using this line of code:
But
path
in this context is not aMethodPath
but the path where the parameters have already been replaced by their value. Because of that, the "json" parser will never be selectedExpected
It's not clear to me what the cleanest fix would be. I suppose
Implementation
could accept a 4th param that would be the originalMethodPath
?Reproduction
Try to use the generated client with a JSON endpoint that has a path parameter
Context
express-zod-api
version: 20.21.1Additional context
Love this lib! Really incredible work!