Skip to content

Commit

Permalink
Clarify request test host settings
Browse files Browse the repository at this point in the history
  • Loading branch information
kstich committed Oct 21, 2021
1 parent d01067e commit f187e93
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions docs/source/1.0/spec/http-protocol-compliance-tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,23 @@ that support the following members:
the query string (for example, "/foo/bar").
* - host
- ``string``
- The host / endpoint provided to the client (for example, "example.com").
- The host or endpoint provided as input to the client (for example,
"example.com").

``host`` MAY contain a path to indicate a base path from which each
operation in the service is appended to. For example, given a ``host``
of ``example.com/foo/bar`` and an operation path of ``/MyOperation``,
the resolved host of the operation is ``example.com`` and the resolved
path is ``/foo/bar/MyOperation``.
* - resolvedHost
- ``string``
- The host / endpoint that the client should send to, not including the
path or scheme (for example, "prefix.example.com").
- The expected host that the client must send to, not including the path
or scheme (for example, "prefix.example.com"). If no resolvedHost is
defined, then no assertions are made about the resolved host for the
request.

This can differ from the host provided to the client if, for instance,
the operation has a member with the :ref:`endpoint-trait`.
This can differ from the ``host`` provided to the client if the
operation has a member with the :ref:`endpoint-trait`.
* - authScheme
- shape ID
- A shape ID that specifies the optional authentication scheme to
Expand Down Expand Up @@ -258,17 +262,21 @@ that uses :ref:`HTTP binding traits <http-traits>`.

use smithy.test#httpRequestTests

@endpoint(hostPrefix: "{hostLabel}.prefix.")
@http(method: "POST", uri: "/")
@httpRequestTests([
{
id: "say_hello",
protocol: exampleProtocol,
params: {
"hostLabel": "foo",
"greeting": "Hi",
"name": "Teddy",
"query": "Hello there"
},
method: "POST",
host: "example.com",
resolvedHost: "foo.prefix.example.com",
uri: "/",
queryParams: [
"Hi=Hello%20there"
Expand All @@ -285,6 +293,10 @@ that uses :ref:`HTTP binding traits <http-traits>`.
}

structure SayHelloInput {
@required
@hostLabel
hostLabel: String,

@httpHeader("X-Greeting")
greeting: String,

Expand All @@ -305,6 +317,9 @@ that uses :ref:`HTTP binding traits <http-traits>`.
"target": "smithy.example#SayHelloInput"
},
"traits": {
"smithy.api#endpoint": {
"hostPrefix": "{hostLabel}.prefix."
},
"smithy.api#http": {
"method": "POST",
"uri": "/",
Expand All @@ -315,6 +330,8 @@ that uses :ref:`HTTP binding traits <http-traits>`.
"id": "say_hello",
"protocol": "smithy.example#exampleProtocol",
"method": "POST",
"host": "example.com",
"resolvedHost": "foo.prefix.example.com",
"uri": "/",
"headers": {
"X-Greeting": "Hi"
Expand All @@ -325,6 +342,7 @@ that uses :ref:`HTTP binding traits <http-traits>`.
"body": "{\"name\": \"Teddy\"}",
"bodyMediaType": "application/json"
"params": {
"hostLabel": "foo",
"greeting": "Hi",
"name": "Teddy",
"query": "Hello there"
Expand All @@ -336,6 +354,13 @@ that uses :ref:`HTTP binding traits <http-traits>`.
"smithy.example#SayHelloInput": {
"type": "structure",
"members": {
"hostLabel": {
"target": "smithy.api#String",
"traits": {
"smithy.api#required": {},
"smithy.api#hostLabel": {}
}
},
"greeting": {
"target": "smithy.api#String",
"traits": {
Expand Down

0 comments on commit f187e93

Please sign in to comment.