Skip to content

[FEATURE] Allow Response Objects and Exceptions to Access Http Response Headers #1647

@fddattal

Description

@fddattal

Is your feature request related to a problem?

A clear and concise description of what the problem is, e.g. I'm always frustrated when [...].

I am using the OpenSearchClient with the AwsSdk2Transport, and I cannot retrieve the http headers in the response. This makes it very hard for me to debug issues with my service provider as I cannot provide them request ids.

What solution would you like?

A clear and concise description of what you want to happen.

I would like for two changes:

  1. All response headers should be available on response objects exposed via a method such as getResponseHeaders().
  2. All exceptions thrown because of a response error should also include the http headers from that response. I propose a class: OpenSearchResponseException to encapsulate this behavior.

What alternatives have you considered?

A clear and concise description of any alternative solutions or features you've considered.

I could not figure out a way to accomplish this by subclassing and overriding code in this package. I would need to migrate to a RestClient or ApacheHttpClient, implement Sigv4 signing, and do my own response parsing.

Do you have any additional context?

Add any other context or screenshots about the feature request here.

Here looks to be where the response is de-serialized and where headers are lost:

https://github.com/opensearch-project/opensearch-java/blob/main/java-client/src/main/java/org/opensearch/client/transport/aws/AwsSdk2Transport.java#L619-L636

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions