Closed Shahab96 closed 4 years ago
Yo, and thanks for reporting!
Are you using a custom mustache template? The reason I am asking is that in method.mustache we are running URI encoding on all the queryparameters, so this should already be handled in the code generated output: Since its in the default template though, it will not be handled automatically if using a custom template
Hi! We aren't using a custom template. The issue is not that query params are not encoded but that the path params are not encoded. For example. domain.com/users/{someUser}/etc?someParam=value
someUser
in this case is not url encoded.
Gotcha, I see what you mean now, thanks! Do you want to attempt a fix? If not I will try to get the time during this week some time
I'll attempt a fix and submit a PR. Thank you!
Fixed in #94
The path appended to the domain may contain strings that have special characters but are not uri encoded.
https://github.com/mtennoe/swagger-typescript-codegen/blob/fbd3d7ad90c57022c7b116a97b93a1ec9cca2ac3/templates/method.mustache#L96
An example of this could be '/someurl/{SomeParam}' evaluating to '/someurl/Some/Param' if SomeParam is 'Some/Param'
This would result in a bad request, where the backend may be expecting something like "Some/Param", for which the request should look like '/someurl/Some%2FParam'