Skip to content
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

Header Fields in API Response #3285

Open
wolf-mptechnology opened this issue Oct 9, 2023 · 10 comments
Open

Header Fields in API Response #3285

wolf-mptechnology opened this issue Oct 9, 2023 · 10 comments
Labels
api Issues related to the API category feature-request Request a new feature

Comments

@wolf-mptechnology
Copy link

Is your feature request related to a problem? Please describe.

We need to fetch the eTag header to implement our own caching. On Android this is already possible, on iOS we only get the data.

Describe the solution you'd like

The access should be similar to the Android version:

let response = try await Amplify.API.get(request: request)
let etag = response.headers["etag"]

Describe alternatives you've considered

It seems there is no way to access response headers at all or it is unclear from the documentation:
https://docs.amplify.aws/lib/restapi/fetch/q/platform/ios/#get-requests

Is the feature request related to any of the existing Amplify categories?

API

Additional context

No response

@thisisabhash thisisabhash added api Issues related to the API category feature-request Request a new feature labels Oct 9, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Oct 9, 2023

This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you!

@thisisabhash
Copy link
Member

Thank you for posting this feature request. Our team will post an update on this ticket.

@atierian
Copy link
Member

An option to explore here is creating overloads for each of the methods (get / put / post / delete / head / patch) with the @_disfavoredOverload annotation to prevent breaking due to ambiguity of overloaded return types.

// exists today - `RESTTask.Success` is a typealias for `Data`.
func get(request: RESTRequest) async throws -> RESTTask.Success

// new overload -- where `NewReturnType` encapsulates the additional information.
@_disfavoredOverload
func get(request: RESTRequest) async throws -> NewReturnType

The existing method that returns Data would likely be removed in the next major version of the library.

@viru-rathore
Copy link

if some information returned as header like session id, which is not available when access response headers.
How can i access response header fields.

@viru-rathore
Copy link

I am facing this issue with NodeJS library of amplify.

@lawmicha
Copy link
Contributor

Hi @viru-rathore, are you using this library? https://github.com/aws-amplify/amplify-js If so, please open an issue over there with more details

@SurajBastola-BO
Copy link

Thank you for posting this feature request. Our team will post an update on this ticket.

Hi, has any update been shared on this request? I'm running into the same issue where we need to get the etag from response headers on a 200 response but I am not able to find any documentation on how this can be achieved. Thanks.

@github-actions github-actions bot added the pending-maintainer-response Issue is pending response from an Amplify team member label Nov 22, 2024
@vincetran
Copy link
Member

@SurajBastola-BO Hi, unfortunately there is no update on this request. We'll post on this issue when there's any update to provide.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Nov 25, 2024
@SurajBastola-BO
Copy link

SurajBastola-BO commented Nov 26, 2024

@SurajBastola-BO Hi, unfortunately there is no update on this request. We'll post on this issue when there's any update to provide.

Thank you. Is this something that has been or is being prioritized on your roadmap?

@github-actions github-actions bot added the pending-maintainer-response Issue is pending response from an Amplify team member label Nov 26, 2024
@tylerjroach
Copy link
Member

@SurajBastola-BO I'll bring this up in our next planning meeting, seeing that this has received quite a few thumbs up.

@github-actions github-actions bot removed the pending-maintainer-response Issue is pending response from an Amplify team member label Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issues related to the API category feature-request Request a new feature
Projects
None yet
Development

No branches or pull requests

8 participants