-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
S3Client: access headers of successful responses #1885
Comments
Here is our workaround, which is a bit clumsy and probably does not support all authentication options correctly: |
Thanks for the feature request. This is something that we want to support on this sdk, but I don't have a timeline for when it will get added. |
So talked about it and what we're coming to is that if there is a specific header that is not modeled in a response, that is a modeling issue, and we want to push back on service teams to more correctly model the headers they are returning to us. So for this specific example of If you notice any headers that are in responses that are not modeled that you want, we can chase the team down to model them. This will solve the problem across all sdks as well and not just cpp. open a ticket if you notice any others headers in response that are un-modeled |
This issue is now closed. Comments on closed issues are hard for our team to see. |
Describe the feature
Be able to access HTTP headers of successful S3 responses from the returned
Outcome
instance.(note: this is a repost of #1466).
Is your Feature Request related to a problem?
When a
S3Client
method returns with a successfulOutcome
, neither the outcome nor the wrapped result give you acces to the HTTP response headers. For example, you can't get the value of a hypothetical "x-amz-bucket-region" header. But there are probably other user cases.(conversely, in case of error, the
AWSError
class gives you access to the HTTP response details)I tried using
SetDataReceivedEventHandler
to intercept the HTTP response, but that handler is only called if the response actually has a body. So HEAD requests don't trigger the handler...Proposed Solution
A possible solution would be to add a
const HeaderValueCollection& GetResponseHeaders () const
method toOutcome
(or to a dedicated subclass ofOutcome
).Another possible solution would be to add a
void SetHeadersReceivedEventHandler(...)
, that handler would be called once when all response headers are received (even if there's no body). The handler's type would probably bestd::function<void(const HttpRequest*, HttpResponse*>
.Describe alternatives you've considered
Currently, I'm writing a
S3Client
subclass so that I can access protected members ofS3Client
and cook the HTTP request manually, call it usingMakeRequest
and then read the headers on the response. But that's cumbersome and fragile. Also, some thing are not available (for exampleComputeEndpointString()
is private, so I can't compute the region signer).Acknowledge
AWS C++ SDK version used
1.9.219
Compiler and Version used
Ubuntu clang version 12.0.0-3ubuntu1~20.04.5
The text was updated successfully, but these errors were encountered: