vue-resource icon indicating copy to clipboard operation
vue-resource copied to clipboard

Chrome creates Blob for body, others browsers don't

Open nelfer opened this issue 9 years ago • 1 comments

Reproduction Link

I do not have a publicly available JSON end point that returns empty ** This might be a Chrome bug, but I'm not sure ** Using vue-resource 1.1.1

Steps to reproduce

Using get() for an AJAX request, it returns empty (nothing in the body). Other browsers, like Firefox and Internet Explorer return a response with body set to null. Content type in request and response is set to application/json. Chrome, however, returns a Blob object: image And so here is where I'm not sure if it's vue-resource that needs to check the response when trying to parse it or if it's Chrome that is doing something funky. Because if I use the method response.json() the promise fails in Chrome saying there's something invalid parsing the JSON and it doesn't fail in other browsers. Looking at the network response, the body is indeed empty (not even {}).

What is Expected?

In all supported browsers, for response.body to be null if content type is application/json and the body content is empty.

What is actually happening?

Only in Chrome, response.body is being created as a Blob object.

nelfer avatar Jun 09 '17 16:06 nelfer

Can you upgrade vue-resource to 1.3.4 and check if this error still happens.

steffans avatar Jun 13 '17 07:06 steffans