-
Notifications
You must be signed in to change notification settings - Fork 111
Fix serialization of REST-JSON requests when the endpoint has a path #368
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
Fix serialization of REST-JSON requests when the endpoint has a path #368
Conversation
| + " context: $L\n" | ||
| + "): Promise<$T> => {", "}", methodName, inputType, contextType, requestType, () -> { | ||
|
|
||
| // Get the hostname, port, and scheme from client's resolved endpoint. Then construct the request from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: basePath
| // Always write the bound path, but only the actual segments. | ||
| writer.write("let resolvedPath = $S;", "/" + trait.getUri().getSegments().stream() | ||
| writer.write("let resolvedPath = `$L` + $S;", | ||
| "${basePath?.endsWith('/') ? basePath.slice(0, -1) : (basePath || '')}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a unit test to add tests for these cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not that I can see, no.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like protocol tests let you specify a custom endpoint, so it should be testable there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Endpoints can have paths (notable example: API Gateway REST APIs without a custom domain name), and serialization of REST-JSON requests was ignoring these paths even though it's available from the endpoint provider.
134eb8f to
69ca9e7
Compare
65ac47f to
02dc06b
Compare
|
Can you post the PR with changes to js sdk v3? |
|
I'm working on getting the pr up |
alexforsyth
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Description of changes:
Endpoints can have paths (notable example: API Gateway REST APIs without a
custom domain name), and serialization of REST-JSON requests was ignoring
these paths even though it's available from the endpoint provider.
Tested this locally against a APIGateway REST API with SigV4 that was broken without it.
This will also impact JS client generation for every REST-JSON service. We have a couple such changes out right now, was going to submit a regeneration PR when all of those land.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.