-
-
Notifications
You must be signed in to change notification settings - Fork 686
Open
Labels
enhancementNew feature or requestNew feature or request
Description
This would solve...
ResponseError interceptor adds the body to the error only if the content type is application/json or text/plain. However, some APIs may have more uncommon content types (for example, they may return text/xml. There are also some more exotic ones: meta sends text/javascript whenever the accept header is missing in the request, and Contentful CMS Management APIs use application/vnd.contentful.management.v1+json, even if there's JSON in the responses).
In these scenarios, ResponseError does not include the body and returns an empty string.
The implementation should look like...
ResponseError may expose a parseBody hook so that, without adding complexitiy to Undici itself, users may add custom extraction/parsing whenever needed.
I have also considered...
Additional context
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request