Skip to content

feat(protocol-http): implement SRA HttpResponse #4520

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

Closed
wants to merge 1 commit into from

Conversation

milesziemer
Copy link
Contributor

Description

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.
  • Use HttpResponse constructor in protocol tests 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.

Testing

CI, yarn test:integration:legacy


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

@milesziemer milesziemer requested review from a team as code owners March 13, 2023 18:07

type HttpResponseOptions = Partial<HttpMessage> & {
statusCode: number;
};

export interface HttpResponse extends IHttpResponse {}
type HttpResponseFromOptions = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like it's part of the public API, so it should be exported, along with HttpResponseOptions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea I wasn't sure why HttpResponse didn't export the options, but HttpRequest did. I'll update it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

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 milesziemer force-pushed the update-httpresponse branch from 36f4ad9 to 15d574f Compare March 13, 2023 19:30
@milesziemer
Copy link
Contributor Author

Closed while issues with header proxy are worked out.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants