-
Notifications
You must be signed in to change notification settings - Fork 201
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
aws-smithy-http-server
: don't ignore empty path segments when routing
#1029
Conversation
In #996 [0], we realized that we were ignoring empty URI path segments when doing label extraction. It turns out we are also ignoring them when doing routing, as the TypeScript sSDK currently does [1], from which the initial implementation was copied. However, a discussion with the Smithy team in smithy-lang/smithy#1024 [2] revealed that we _must not_ ignore empty URI path segments when routing or doing label extraction, since empty strings (`""`) should be assigned to the labels in those segments. This commit fixes the behavior so that we don't ignore empty path segments _when doing routing_. #996 will take care of fixing the behavior when doing label extraction. [0]: #996 (comment) [1]: https://github.com/awslabs/smithy-typescript/blob/d263078b81485a6a2013d243639c0c680343ff47/smithy-typescript-ssdk-libs/server-common/src/httpbinding/mux.ts#L78 [2]: smithy-lang/smithy#1024
A new doc preview is ready to view. |
A new generated diff is ready to view.
|
A new doc preview is ready to view. |
A new generated diff is ready to view.
|
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.
LGTM
A new doc preview is ready to view. |
A new generated diff is ready to view.
|
A new doc preview is ready to view. |
A new generated diff is ready to view.
|
…ce test The previous commit introduced a failing test because CI doesn't have Rust tests as a blocking step and auto-merge was enabled. With the two operations: 1. `ListBuckets` with URI pattern `/`; and 2. `ListObjects` with URI pattern `/{bucket}`, the test wants to route the request `/` to the first operation. However, in #1029 we started allowing empty path segments. Since `ListBuckets` has more weight than `ListObjects`, the request matches against it, binding `""` to the `bucket` label.
…ce test (#1070) The previous commit introduced a failing test because CI doesn't have Rust tests as a blocking step and auto-merge was enabled. With the two operations: 1. `ListBuckets` with URI pattern `/`; and 2. `ListObjects` with URI pattern `/{bucket}`, the test wants to route the request `/` to the first operation. However, in #1029 we started allowing empty path segments. Since `ListBuckets` has more weight than `ListObjects`, the request matches against it, binding `""` to the `bucket` label.
In #996 0, we realized that we were ignoring empty URI path segments
when doing label extraction. It turns out we are also ignoring them when
doing routing, as the TypeScript sSDK currently does 1, from which the
initial implementation was copied.
However, a discussion with the Smithy team in smithy-lang/smithy#1024 2
revealed that we must not ignore empty URI path segments when routing
or doing label extraction, since empty strings (
""
) should be assignedto the labels in those segments.
This commit fixes the behavior so that we don't ignore empty path
segments when doing routing. #996 will take care of fixing the behavior
when doing label extraction.
Testing
Test suite has been expanded.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.