-
Notifications
You must be signed in to change notification settings - Fork 77
Description
Hello, thanks for the wonderful library, it's been super helpful!
I have run into a couple issues with the final json parsing of the response body failing when the response contains file data for download or when a basic string is returned, like when returning a plain token without a json wrapper. I'm wondering if there is an existing workaround, or if an MR to address these issues would be useful.
For the file download endpoints, I'm using Phoenix.Controller.send_download/3. There are {"content-type", "application/zip"} and {"content-disposition", "attachment; filename=\"file_name.zip\""} headers that could potentially be used to identify file payloads.
For the plain string, I was able to work around it by adding escaped quotes like so "\"token\"", but it seems like the library should be able to handle basic strings in the body. We could use the JSON.encode function without the exclamation and then if the error tuple is returned, skip the prettify step and let it be a regular binary, or something along those lines.
Thanks!