From 09e24de125df8922bb81724b36bb34e3d36e7778 Mon Sep 17 00:00:00 2001 From: Russell Cohen Date: Sun, 16 May 2021 16:21:58 -0400 Subject: [PATCH 1/3] Add Protocol Test for XML Escaping Add protocol response test to cover XML escaping of literals as well as decimal & hexidecimal escape sequences. --- .../model/restXml/document-structs.smithy | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/smithy-aws-protocol-tests/model/restXml/document-structs.smithy b/smithy-aws-protocol-tests/model/restXml/document-structs.smithy index 6e7d8d7671c..1be0eadbb65 100644 --- a/smithy-aws-protocol-tests/model/restXml/document-structs.smithy +++ b/smithy-aws-protocol-tests/model/restXml/document-structs.smithy @@ -143,12 +143,17 @@ apply SimpleScalarProperties @httpResponseTests([ }, { id: "SimpleScalarPropertiesWithEscapedCharacter", - documentation: "Serializes string with escaping", + documentation: """ + Serializes string with escaping. + + This validates the three escape types: literal, decimal and hexidecimal. It also validates that unescaping properly + handles the case where unescaping an & produces a newly formed escape sequence (this should not be re-unescaped). + """, protocol: restXml, code: 200, body: """ - <string> + escaped data: &lt; """, bodyMediaType: "application/xml", @@ -158,7 +163,7 @@ apply SimpleScalarProperties @httpResponseTests([ }, params: { foo: "Foo", - stringValue: "", + stringValue: "escaped data: <\r\n", } }, { From 7782a38f642f2ec3b30c5ca6833bb85897cb2b3a Mon Sep 17 00:00:00 2001 From: Russell Cohen Date: Sun, 16 May 2021 16:24:09 -0400 Subject: [PATCH 2/3] Correct spelling of "hexadecimal" --- smithy-aws-protocol-tests/model/restXml/document-structs.smithy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/smithy-aws-protocol-tests/model/restXml/document-structs.smithy b/smithy-aws-protocol-tests/model/restXml/document-structs.smithy index 1be0eadbb65..8f331e39ae2 100644 --- a/smithy-aws-protocol-tests/model/restXml/document-structs.smithy +++ b/smithy-aws-protocol-tests/model/restXml/document-structs.smithy @@ -146,7 +146,7 @@ apply SimpleScalarProperties @httpResponseTests([ documentation: """ Serializes string with escaping. - This validates the three escape types: literal, decimal and hexidecimal. It also validates that unescaping properly + This validates the three escape types: literal, decimal and hexadecimal. It also validates that unescaping properly handles the case where unescaping an & produces a newly formed escape sequence (this should not be re-unescaped). """, protocol: restXml, From c9ff564dce855f1fbde07ea48046be46bc2497c1 Mon Sep 17 00:00:00 2001 From: Russell Cohen Date: Fri, 21 May 2021 13:01:10 -0400 Subject: [PATCH 3/3] Split test into client vs. dual Add applies to client to the complex test and bring the old test back for clients & servers. --- .../model/restXml/document-structs.smithy | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/smithy-aws-protocol-tests/model/restXml/document-structs.smithy b/smithy-aws-protocol-tests/model/restXml/document-structs.smithy index 8f331e39ae2..c273ec4bcfd 100644 --- a/smithy-aws-protocol-tests/model/restXml/document-structs.smithy +++ b/smithy-aws-protocol-tests/model/restXml/document-structs.smithy @@ -142,12 +142,14 @@ apply SimpleScalarProperties @httpResponseTests([ } }, { - id: "SimpleScalarPropertiesWithEscapedCharacter", + id: "SimpleScalarPropertiesComplexEscapes", documentation: """ Serializes string with escaping. This validates the three escape types: literal, decimal and hexadecimal. It also validates that unescaping properly handles the case where unescaping an & produces a newly formed escape sequence (this should not be re-unescaped). + + Servers may produce different output, this test is designed different unescapes clients must handle """, protocol: restXml, code: 200, @@ -164,6 +166,27 @@ apply SimpleScalarProperties @httpResponseTests([ params: { foo: "Foo", stringValue: "escaped data: <\r\n", + }, + appliesTo: "client", + }, + { + id: "SimpleScalarPropertiesWithEscapedCharacter", + documentation: "Serializes string with escaping", + protocol: restXml, + code: 200, + body: """ + + <string> + + """, + bodyMediaType: "application/xml", + headers: { + "Content-Type": "application/xml", + "X-Foo": "Foo", + }, + params: { + foo: "Foo", + stringValue: "", } }, {