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

Add Content-Length required header to request protocol tests #491

Merged
merged 1 commit into from
Jul 10, 2020
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
3 changes: 3 additions & 0 deletions smithy-aws-protocol-tests/model/awsJson1_1/documents.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ apply PutAndGetInlineDocuments @httpRequestTests([
}""",
bodyMediaType: "application/json",
headers: {"Content-Type": "application/json"},
requireHeaders: [
"Content-Length"
],
params: {
inlineDocument: {
foo: "bar"
Expand Down
84 changes: 84 additions & 0 deletions smithy-aws-protocol-tests/model/awsJson1_1/kitchen-sink.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes string shapes",
body: "{\"String\":\"abc xyz\"}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
String: "abc xyz",
},
Expand All @@ -25,6 +28,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes string shapes with jsonvalue trait",
body: "{\"JsonValue\":\"{\\\"string\\\":\\\"value\\\",\\\"number\\\":1234.5,\\\"boolTrue\\\":true,\\\"boolFalse\\\":false,\\\"array\\\":[1,2,3,4],\\\"object\\\":{\\\"key\\\":\\\"value\\\"},\\\"null\\\":null}\"}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
JsonValue: "{\"string\":\"value\",\"number\":1234.5,\"boolTrue\":true,\"boolFalse\":false,\"array\":[1,2,3,4],\"object\":{\"key\":\"value\"},\"null\":null}",
},
Expand All @@ -37,6 +43,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes integer shapes",
body: "{\"Integer\":1234}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
Integer: 1234,
},
Expand All @@ -49,6 +58,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes long shapes",
body: "{\"Long\":999999999999}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
Long: 999999999999,
},
Expand All @@ -61,6 +73,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes float shapes",
body: "{\"Float\":1234.5}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
Float: 1234.5,
},
Expand All @@ -73,6 +88,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes double shapes",
body: "{\"Double\":1234.5}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
Double: 1234.5,
},
Expand All @@ -85,6 +103,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes blob shapes",
body: "{\"Blob\":\"YmluYXJ5LXZhbHVl\"}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
Blob: "binary-value",
},
Expand All @@ -97,6 +118,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes boolean shapes (true)",
body: "{\"Boolean\":true}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
Boolean: true,
},
Expand All @@ -109,6 +133,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes boolean shapes (false)",
body: "{\"Boolean\":false}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
Boolean: false,
},
Expand All @@ -121,6 +148,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes timestamp shapes",
body: "{\"Timestamp\":946845296}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
Timestamp: 946845296,
},
Expand All @@ -133,6 +163,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes timestamp shapes with iso8601 timestampFormat",
body: "{\"Iso8601Timestamp\":\"2000-01-02T20:34:56Z\"}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
Iso8601Timestamp: 946845296,
},
Expand All @@ -145,6 +178,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes timestamp shapes with httpdate timestampFormat",
body: "{\"HttpdateTimestamp\":\"Sun, 02 Jan 2000 20:34:56 GMT\"}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
HttpdateTimestamp: 946845296,
},
Expand All @@ -157,6 +193,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes timestamp shapes with unixTimestamp timestampFormat",
body: "{\"UnixTimestamp\":946845296}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
UnixTimestamp: 946845296,
},
Expand All @@ -169,6 +208,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes list shapes",
body: "{\"ListOfStrings\":[\"abc\",\"mno\",\"xyz\"]}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
ListOfStrings: [
"abc",
Expand All @@ -185,6 +227,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes empty list shapes",
body: "{\"ListOfStrings\":[]}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
ListOfStrings: [],
},
Expand All @@ -197,6 +242,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes list of map shapes",
body: "{\"ListOfMapsOfStrings\":[{\"foo\":\"bar\"},{\"abc\":\"xyz\"},{\"red\":\"blue\"}]}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
ListOfMapsOfStrings: [
{
Expand All @@ -219,6 +267,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes list of structure shapes",
body: "{\"ListOfStructs\":[{\"Value\":\"abc\"},{\"Value\":\"mno\"},{\"Value\":\"xyz\"}]}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
ListOfStructs: [
{
Expand All @@ -241,6 +292,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes list of recursive structure shapes",
body: "{\"RecursiveList\":[{\"RecursiveList\":[{\"RecursiveList\":[{\"Integer\":123}]}]}]}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
RecursiveList: [
{
Expand All @@ -265,6 +319,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes map shapes",
body: "{\"MapOfStrings\":{\"abc\":\"xyz\",\"mno\":\"hjk\"}}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
MapOfStrings: {
abc: "xyz",
Expand All @@ -280,6 +337,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes empty map shapes",
body: "{\"MapOfStrings\":{}}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
MapOfStrings: {},
},
Expand All @@ -292,6 +352,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes map of list shapes",
body: "{\"MapOfListsOfStrings\":{\"abc\":[\"abc\",\"xyz\"],\"mno\":[\"xyz\",\"abc\"]}}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
MapOfListsOfStrings: {
abc: [
Expand All @@ -313,6 +376,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes map of structure shapes",
body: "{\"MapOfStructs\":{\"key1\":{\"Value\":\"value-1\"},\"key2\":{\"Value\":\"value-2\"}}}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
MapOfStructs: {
key1: {
Expand All @@ -332,6 +398,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes map of recursive structure shapes",
body: "{\"RecursiveMap\":{\"key1\":{\"RecursiveMap\":{\"key2\":{\"RecursiveMap\":{\"key3\":{\"Boolean\":false}}}}}}}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
RecursiveMap: {
key1: {
Expand All @@ -356,6 +425,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes structure shapes",
body: "{\"SimpleStruct\":{\"Value\":\"abc\"}}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
SimpleStruct: {
Value: "abc",
Expand All @@ -370,6 +442,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes structure members with locationName traits",
body: "{\"StructWithLocationName\":{\"RenamedMember\":\"some-value\"}}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
StructWithLocationName: {
Value: "some-value",
Expand All @@ -384,6 +459,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes empty structure shapes",
body: "{\"SimpleStruct\":{}}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
SimpleStruct: {},
},
Expand All @@ -396,6 +474,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes structure which have no members",
body: "{\"EmptyStruct\":{}}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
EmptyStruct: {},
},
Expand All @@ -408,6 +489,9 @@ use smithy.test#httpResponseTests
documentation: "Serializes recursive structure shapes",
body: "{\"String\":\"top-value\",\"Boolean\":false,\"RecursiveStruct\":{\"String\":\"nested-value\",\"Boolean\":true,\"RecursiveList\":[{\"String\":\"string-only\"},{\"RecursiveStruct\":{\"MapOfStrings\":{\"color\":\"red\",\"size\":\"large\"}}}]}}",
bodyMediaType: "application/json",
requireHeaders: [
"Content-Length"
],
params: {
String: "top-value",
Boolean: false,
Expand Down
33 changes: 33 additions & 0 deletions smithy-aws-protocol-tests/model/awsQuery/input.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ apply SimpleInputParams @httpRequestTests([
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
requireHeaders: [
"Content-Length"
],
body: """
Action=SimpleInputParams
&Version=2020-01-08
Expand All @@ -44,6 +47,9 @@ apply SimpleInputParams @httpRequestTests([
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
requireHeaders: [
"Content-Length"
],
body: """
Action=SimpleInputParams
&Version=2020-01-08
Expand All @@ -64,6 +70,9 @@ apply SimpleInputParams @httpRequestTests([
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
requireHeaders: [
"Content-Length"
],
body: """
Action=SimpleInputParams
&Version=2020-01-08
Expand All @@ -82,6 +91,9 @@ apply SimpleInputParams @httpRequestTests([
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
requireHeaders: [
"Content-Length"
],
body: """
Action=SimpleInputParams
&Version=2020-01-08
Expand All @@ -100,6 +112,9 @@ apply SimpleInputParams @httpRequestTests([
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
requireHeaders: [
"Content-Length"
],
body: """
Action=SimpleInputParams
&Version=2020-01-08
Expand All @@ -118,6 +133,9 @@ apply SimpleInputParams @httpRequestTests([
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
requireHeaders: [
"Content-Length"
],
body: """
Action=SimpleInputParams
&Version=2020-01-08
Expand All @@ -136,6 +154,9 @@ apply SimpleInputParams @httpRequestTests([
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
requireHeaders: [
"Content-Length"
],
body: """
Action=SimpleInputParams
&Version=2020-01-08
Expand Down Expand Up @@ -176,6 +197,9 @@ apply QueryTimestamps @httpRequestTests([
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
requireHeaders: [
"Content-Length"
],
body: """
Action=QueryTimestamps
&Version=2020-01-08
Expand Down Expand Up @@ -220,6 +244,9 @@ apply NestedStructures @httpRequestTests([
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
requireHeaders: [
"Content-Length"
],
body: """
Action=NestedStructures
&Version=2020-01-08
Expand Down Expand Up @@ -265,6 +292,9 @@ apply QueryIdempotencyTokenAutoFill @httpRequestTests([
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
requireHeaders: [
"Content-Length"
],
body: """
Action=QueryIdempotencyTokenAutoFill
&Version=2020-01-08
Expand All @@ -280,6 +310,9 @@ apply QueryIdempotencyTokenAutoFill @httpRequestTests([
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
requireHeaders: [
"Content-Length"
],
body: """
Action=QueryIdempotencyTokenAutoFill
&Version=2020-01-08
Expand Down
Loading