Skip to content
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

Percent Encoding Test & Spec Enhancements #803

Merged
merged 2 commits into from
May 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/source/1.0/spec/core/http-traits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ structure with the ``httpLabel`` trait MUST have a corresponding
``1985-04-12T23%3A20%3A50.52Z``). The :ref:`timestampFormat-trait`
MAY be used to use a custom serialization format.
- Reserved characters defined in :rfc:`section 2.2 of RFC3986 <3986#section-2.2>`
MUST be percent-encoded_ (that is, ``:/?#[]@!$&'()*+,;=``).
and the `%` itself MUST be percent-encoded_ (that is, ``:/?#[]@!$&'()*+,;=%``).
- However, if the label is greedy, then "/" MUST NOT be percent-encoded
because greedy labels are meant to span multiple path segments.

Expand Down Expand Up @@ -894,8 +894,8 @@ request:

* "&" is used to separate query string parameter key-value pairs.
* "=" is used to separate query string parameter names from values.
* Reserved characters in keys and values as defined in :rfc:`section 2.2 of RFC3986 <3986#section-2.2>`
MUST be percent-encoded_ (that is, ``:/?#[]@!$&'()*+,;=``).
* Reserved characters in keys and values as defined in :rfc:`section 2.2 of RFC3986 <3986#section-2.2>` and `%`
MUST be percent-encoded_ (that is, ``:/?#[]@!$&'()*+,;=%``).
* ``boolean`` values are serialized as ``true`` or ``false``.
* ``timestamp`` values are serialized as an :rfc:`3339`
``date-time`` string by default (for example, ``1985-04-12T23:20:50.52Z``,
Expand Down
22 changes: 20 additions & 2 deletions smithy-aws-protocol-tests/model/restJson1/http-labels.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,24 @@ apply HttpRequestWithLabels @httpRequestTests([
timestamp: 1576540098
}
},
{
id: "RestJsonHttpRequestLabelEscaping",
documentation: "Sends a GET request that uses URI label bindings",
protocol: restJson1,
method: "GET",
uri: "/HttpRequestWithLabels/%25%3A%2F%3F%23%5B%5D%40%21%24%26%27%28%29%2A%2B%2C%3B%3D%F0%9F%98%B9/1/2/3/4.1/5.1/true/2019-12-16T23%3A48%3A18Z",
body: "",
params: {
string: "%:/?#[]@!$&'()*+,;=😹",
short: 1,
integer: 2,
long: 3,
float: 4.1,
double: 5.1,
boolean: true,
timestamp: 1576540098
}
},
])

structure HttpRequestWithLabelsInput {
Expand Down Expand Up @@ -159,10 +177,10 @@ apply HttpRequestWithGreedyLabelInPath @httpRequestTests([
documentation: "Serializes greedy labels and normal labels",
protocol: restJson1,
method: "GET",
uri: "/HttpRequestWithGreedyLabelInPath/foo/hello/baz/there/guy",
uri: "/HttpRequestWithGreedyLabelInPath/foo/hello%2Fescape/baz/there/guy",
body: "",
params: {
foo: "hello",
foo: "hello/escape",
baz: "there/guy",
}
},
Expand Down
14 changes: 14 additions & 0 deletions smithy-aws-protocol-tests/model/restJson1/http-query.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,20 @@ apply AllQueryStringTypes @httpRequestTests([
"QueryParamsStringKeyB": "Bar",
},
}
},
{
id: "RestJsonQueryStringEscaping",
documentation: "Handles escaping all required characters in the query string.",
protocol: restJson1,
method: "GET",
uri: "/AllQueryStringTypesInput",
body: "",
queryParams: [
"String=%25%3A%2F%3F%23%5B%5D%40%21%24%26%27%28%29%2A%2B%2C%3B%3D%F0%9F%98%B9",
],
params: {
queryString: "%:/?#[]@!$&'()*+,;=😹"
}
}
])

Expand Down