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

Exposing response headers in APIException #2524

Closed
andrueastman opened this issue Apr 5, 2023 · 9 comments
Closed

Exposing response headers in APIException #2524

andrueastman opened this issue Apr 5, 2023 · 9 comments
Assignees
Labels
ADR Csharp Pull requests that update .net code enhancement New feature or request Go Java TypeScript Pull requests that update Javascript code
Milestone

Comments

@andrueastman
Copy link
Member

Related to microsoftgraph/msgraph-sdk-dotnet#1755

ApiException currently exposes the status code for the failed request(#2216)

We can look into adding a Dictionary to APIException to hold the response headers when the error is thrown so as users can access header information that may be useful incase something goes wrong.

Implementation wise, the change should be straightforward as the request adapters have direct access to the headers from the native response objects, similar to the status code in the ThrowIfFailedResponse method.

C# - https://github.com/microsoft/kiota-http-dotnet/blob/2c6d3a411e4925f199f4da8dc10fd5861d69dec0/src/HttpClientRequestAdapter.cs#L344
Java - https://github.com/microsoft/kiota-java/blob/34b716a46ea713e9eff93fc067614c287451e42f/components/http/okHttp/src/main/java/com/microsoft/kiota/http/OkHttpRequestAdapter.java#L583
Typescript - https://github.com/microsoft/kiota-typescript/blob/81e25fa0669afff21af91131a77c275845f6a756/packages/http/fetch/src/fetchRequestAdapter.ts#L308
Go - https://github.com/microsoft/kiota-http-go/blob/main/nethttp_request_adapter.go#L790

@baywet baywet added this to the Kiota v1.2 milestone Apr 5, 2023
@baywet baywet added this to Kiota Apr 5, 2023
@github-project-automation github-project-automation bot moved this to Todo in Kiota Apr 5, 2023
@baywet baywet added enhancement New feature or request and removed Needs: Triage 🔍 labels Apr 5, 2023
@baywet baywet self-assigned this Apr 5, 2023
@baywet
Copy link
Member

baywet commented Apr 5, 2023

@darrelmiller do we have a sign-off on that?

@sebastienlevert
Copy link
Contributor

Myself and @darrelmiller are actually discussing Response in a broader scope (available also outside of APIException). Let's wait for this discussion to close before we take on this one.

@vadrsa
Copy link

vadrsa commented Apr 14, 2023

@sebastienlevert @baywet @darrelmiller Any chance this will be included in next release, this is blocker for us to upgrade to Graph V5 and use new endpoints to support our clients. I will be happy to help in implementation if needed.

@baywet
Copy link
Member

baywet commented Apr 14, 2023

We do have a design for it @sebastienlevert needs to detail here. Once the design is agreed upon we'll be able to start the work. The scope expanded a little as we're talking about giving access to response headers for both exceptions but also for successful requests. There's a low chance for this to slip from the upcoming to the next release at this point (so not 1.2 but 1.3)

@darrelmiller
Copy link
Member

Based on our discussions, we are going to add all the HTTP response headers to the ApiException object. In the future if there is a need to disable this behaviour for performance reasons we will add a request option that allows developers to disable this feature.

@baywet
Copy link
Member

baywet commented Apr 14, 2023

@andrueastman is this something you'd want to take on across our primary languages? If you're too busy I'll take it. Not suggesting Ronald as he is wrapping up the Go GA.

@andrueastman
Copy link
Member Author

No worries @baywet. Will take this on as its not big one.

@github-project-automation github-project-automation bot moved this from In Progress to Done in Kiota Apr 27, 2023
@baywet
Copy link
Member

baywet commented Apr 27, 2023

Thanks a lot for the great work across the board @andrueastman!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ADR Csharp Pull requests that update .net code enhancement New feature or request Go Java TypeScript Pull requests that update Javascript code
Projects
Archived in project
Development

No branches or pull requests

5 participants