-
-
Notifications
You must be signed in to change notification settings - Fork 793
Description
From @eric-burel on June 8, 2018 8:32
Hi,
I noticed that the fetch service always does a response.json(), however in many case you might need another conversion (e.g response.blob() for files). For the moment, reading the code, I think this can't be configured (tell me if I am wrong though), that could be a good enhancement.
However I wonder what would be the best pattern. Having response.json as a default makes sense, as it is consistent with other solutions (axios etc.).
The potential solutions:
- figuring out the best option depending on the mime type. I think it only partially solve the issue, as I could still want my image as a string and not a blob() for example, and would be tedious to implement.
- adding a custom parameter to tell
fetchwhat to use.responseTypeis a good candidate, as it would be consistent with XHR (so axios too and maybe other services).
Edit: actually I can't figure this out either for axios, the responseType does not seem to be customizable.
Edit 2: okay I figured out your last commit now allow this for Axios, I needed to update the lib.
Copied from original issue: feathersjs-ecosystem/rest-client#32