Skip to content

Use HttpResponse constructor in protocol tests #698

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

Conversation

milesziemer
Copy link
Contributor

Description of changes:
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.

Tested via js v3 sdk.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

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.
@milesziemer milesziemer requested review from a team as code owners February 21, 2023 16:28
@milesziemer milesziemer merged commit 9472517 into smithy-lang:main Mar 8, 2023
milesziemer added a commit to milesziemer/aws-sdk-js-v3 that referenced this pull request Mar 9, 2023
This commit contains changes from the codegen changes in
smithy-lang/smithy-typescript#698. It updates
protocol tests to construct the HttpResponse object, instead of
using a regular object.
kuhe pushed a commit to aws/aws-sdk-js-v3 that referenced this pull request Mar 9, 2023
This commit contains changes from the codegen changes in
smithy-lang/smithy-typescript#698. It updates
protocol tests to construct the HttpResponse object, instead of
using a regular object.
milesziemer added a commit to milesziemer/aws-sdk-js-v3 that referenced this pull request Mar 13, 2023
This change implements the core functionality of HttpResponse for SRA.
New properties were added to the HttpResponse class, old properties and
interfaces were deprecated. To maintain compatibility with old
implementation, Proxy was added for headers property, and
Object.defineProperties is used with getters/setters for other old
properties. This change does not include updates to the SDK to use new
functionality.

Additional notes:
* HttpResponse.isInstance was left unchanged to maintain compatibility.
  Previous implementation only checked for specific properties, so it
would return true when passed the HttpResponse interface from types
package.
* smithy-lang/smithy-typescript#698 is a related
  change that ensures protocol tests are using HttpResponse constructor.
Due to type changes in HttpResponse, this is required.
milesziemer added a commit to milesziemer/aws-sdk-js-v3 that referenced this pull request Mar 13, 2023
This change implements the core functionality of HttpResponse for SRA.
New properties were added to the HttpResponse class, old properties and
interfaces were deprecated. To maintain compatibility with old
implementation, Proxy was added for headers property, and
Object.defineProperties is used with getters/setters for other old
properties. This change does not include updates to the SDK to use new
functionality.

Additional notes:
* HttpResponse.isInstance was left unchanged to maintain compatibility.
  Previous implementation only checked for specific properties, so it
would return true when passed the HttpResponse interface from types
package.
* smithy-lang/smithy-typescript#698 is a related
  change that ensures protocol tests are using HttpResponse constructor.
Due to type changes in HttpResponse, this is required.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants