-
Notifications
You must be signed in to change notification settings - Fork 619
feat(protocol-http): implement SRA HttpRequest #4514
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
5be0aa9
to
f6a5766
Compare
fields: Fields.from( | ||
this.fields.getAll().map((field) => ({ | ||
...field, | ||
values: [...field.values], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps fields should implement clone. Hard to remember to do this every time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea I thought about it. I figured we could implement it later if we needed it rather than exposing it now, but I don't have a strong opinion either way.
This change implements the core functionality of HttpRequest for SRA. New properties were added to the HttpRequest class, old properties and interfaces were deprecated. Proxy was added for headers and query properties to maintain backward compatibility. This change does not include updates to the SDK to use new functionality. Notes on other changes: * middleware-host-header and middleware-sdk-transcribe-streaming tests: URL.port always returns '' if port is set to the default for the protocol. * middleware-sdk-transcribe-streaming: Providing URL.hostname with a string containing the port number does not update the port. * signature-v4 prepareRequest: See comment in code. * Field: toString method was changed to only require double quotes on values with commas. Current tests allow spaces without double quotes. * Fields: Helper methods were added for getting all fields and creating a Fields object. Additional notes: * When converting between single string header values and a list of field values, split(",") and join(",") are used to avoid making any modifications to the original value, preserving compatibility. * HttpRequest.isInstance was not modified, because doing so might break compatibility. The check was not looking for the clone method, so wasn't actually verifying the object was indeed an instance. The method could easily have been used on a HttpRequest interface from the types package, and returned true.
f6a5766
to
8ae2760
Compare
This reverts commit d9d24b0. A bug was found with this commit when using a Symbol as a key, or a non-string as a value in `request.headers`.
This reverts commit d9d24b0. A bug was found with this commit when using a Symbol as a key, or a non-string as a value in `request.headers`.
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. |
Description
This change implements the core functionality of HttpRequest for SRA. New properties were added to the HttpRequest class, old properties and interfaces were deprecated. Proxy was added for headers and query properties to maintain backward compatibility. This change does not include updates to the SDK to use new functionality.
Notes on other changes:
Additional notes:
Testing
yarn test:all
Additional context
Because custom middleware can have access to the HttpRequest object, Proxies, getters, and setters are being used
to allow old members of HttpRequest to be used.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.