HttpRequestException when DeserializeOutput is called
zetomatoz opened this issue · comments
Thomas commented
Microsoft.Identity.Web Library
Microsoft.Identity.Web.DownstreamApi
Microsoft.Identity.Web version
2.19.0
Web app
Sign-in users and call web APIs
Web API
Protected web APIs call downstream web APIs
Token cache serialization
Not Applicable
Description
By design, DeserializeOutput checks that the HttpResponseMessage has a successful status code. If this is not the case, then an HttpRequestException is raised. This behavior does not relate to the deserialization and can be considered as misleading.
Reproduction steps
- A downstream api responds with a 500 error
- Any methods that accept TOutput in the partial class DownstreamApi.HttpMethods can raise an HttpRequestException when the response is being deserialized.
Error message
Id Web logs
No response
Relevant code snippets
N/A
Regression
No response
Expected behavior
When DeserializeOutput gets called, then exceptions thrown are only related to the deserialization process.