-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
escaped parameters fail to generate the correct url path when a base path is present. #1083
Labels
Comments
1 task
Verified today the status of this long standing issue... :) OK so this works just fine. Preparing a PR that adds this interesting test to exercise the full rountrip with all runtime dependencies. |
fredbi
added a commit
to fredbi/go-swagger
that referenced
this issue
Dec 27, 2023
Added a test that constructs a generated client, dynamic untyped server and exercise the stack (in this case, asserting how an escaped path parameter moves across the stack from runtime client to runtime server). * fixes go-swagger#1083 (asserts was already working) Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
fredbi
added a commit
to fredbi/go-swagger
that referenced
this issue
Dec 27, 2023
Added a test that constructs a generated client, dynamic untyped server and exercise the stack (in this case, asserting how an escaped path parameter moves across the stack from runtime client to runtime server). * fixes go-swagger#1083 (asserts was already working) Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
fredbi
added a commit
that referenced
this issue
Dec 28, 2023
Added a test that constructs a generated client, dynamic untyped server and exercise the stack (in this case, asserting how an escaped path parameter moves across the stack from runtime client to runtime server). * fixes #1083 (asserts was already working) Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
If a path parameter needs to be escaped the runtime code generates an invalid path.
BasePath = "/foo"
Path = "/v1/{param}"
I suggest adding a transport to the HTTP client that dumps the request.
These fail because of the runtime/client's interaction with URL.
The http client uses URL.EscapedPath() to determine what path to use.
client.Runtime.Submit has the following code:
setting
req.URL.Path = path.Join(r.BasePath, req.URL.Path)
causes url.EscapedPath() to returnreq.URL.Path unescaped, since escape(u.Path, encodePath) only escapes the ?, it assumes the fragments have already been properly escaped.
the fix is to properly set both the RawPath and the Path in the submit function.
I also believe that
func (r *request) BuildHTTP(...) (*http.Request, error) {
should properly escape the path parameters, but that breaks current behaviour.Environment
swagger version: master, d507f49
go version: 1.8.1
OS: linux
The text was updated successfully, but these errors were encountered: