What should I do if the server is sending binary data?

Responsive Ad Header

Question

Grade: Education Subject: Support
What should I do if the server is sending binary data?
Asked by:
54 Viewed 54 Answers

Answer (54)

Best Answer
(325)
If the server is intentionally sending binary data (like an image or file), ensure the `Content-Type` header reflects this (e.g., `image/png`). When making the request, you might need to specify `responseType: 'arraybuffer'` or `responseType: 'stream'` in your Axios configuration to instruct Axios to treat the data as such.