Skip to content

Commit f964669

Browse files
committed
Use HttpResponse constructor in protocol tests
Updates the TS protocol test stub to construct HttpResponse objects using the class constructor, instead of with object syntax. The constructor has optional parameters, so when updating the HttpResponse implementation we can continue to pass old properties. Without using the constructor, we have to change the HttpResponse interface and protocol test codegen simulataneously to avoid breaking changes.
1 parent 82a5a39 commit f964669

File tree

1 file changed

+2
-2
lines changed
  • smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen

1 file changed

+2
-2
lines changed

smithy-typescript-codegen/src/main/resources/software/amazon/smithy/typescript/codegen/protocol-test-stub.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ class ResponseDeserializationTestHandler implements HttpHandler {
5757
options?: HttpHandlerOptions
5858
): Promise<{ response: HttpResponse }> {
5959
return Promise.resolve({
60-
response: {
60+
response: new HttpResponse({
6161
statusCode: this.code,
6262
headers: this.headers,
6363
body: Readable.from([this.body])
64-
}
64+
})
6565
});
6666
}
6767
}

0 commit comments

Comments
 (0)