Consistently populate request_id in request context metadata in XML requests #2715
Closed
1 of 2 tasks
Labels
feature-request
A feature should be added or improved.
needs-triage
This issue or PR still needs to be triaged.
Describe the feature
Populate request_id in the request context object when the server returns an error for an XML formatted request
Use Case
Consistently determine a request_id value for both failed and successful API responses.
For example:
instead of:
Proposed Solution
Populate request_id in request contexts in
Aws::Query::Handler
or populate request_id for error cases inAws::XML::ErrorHandler
Given that
Aws::JSON::Handler
andAws::REST::Handler
both put this responsibility into the "protocol handler", it seems most consistent to put it inAws::Query::Handler
-- however both of those implementations rely on the HTTP response header to determine the request id, and are therefore not required to do any error message parsing to achieve this result.It's not clear to me when it is preferable to use the HTTP header, or the XML response body, but if the response body is preferrable, perhaps
Aws::XML::ErrorHandler
would be a better place to locate this code.Other Information
Aws::Json::Handler
populates the request context's metadata field uning the value of thex-amzn-requestid
header early in the handler list when errors are raised by the server:Aws::RESST::Handler
also uses this pattern:The XML-formatted equvalent
Aws::Query::Handler
also populates request_id, but using value returned in the response body, and only for successful responses:Aws::XML::ErrorHandler
seems to handle parsing of XML bodies during error cases, but it does not have any awareness of therequest_id
field.As an aside, this may have been addressed specifically for EC2 as part of #1038
Acknowledgements
SDK version used
3.0.2
Environment details (OS name and version, etc.)
macOS Moneteray 12.3.1, various linuxes
The text was updated successfully, but these errors were encountered: