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

Response didn't get parsed JSON object in X5(we-chat browser)

Open lsvih opened this issue 10 years ago • 4 comments

It has some wrong with those browsers.I can get the JSON object in chrome,firefox and newest IE,but I get "string" in older IE and wechat browser.

lsvih avatar Nov 06 '16 11:11 lsvih

similiar problem:

Browser: Chrome Prod env: LNMP & https schema. Got output below via console.log(response) image

Local env: LNMP & http schema but works well. It also works before I deploy SSL cert in Prod env. I am quite sure, that the content negotiation is right. Weired.

Currently fixed it via below:

Vue.http.interceptors.push((request, next) => {
    next((response)=>{
        if (typeof response.data === "string") {
            response.data = JSON.parse(response.data)
        }
//other following code

raphaelsoul avatar Nov 07 '16 11:11 raphaelsoul

@raphaelsoul Now I have used axios to replace it. Axios is easy to use,its usage is similar to this lib.

lsvih avatar Nov 07 '16 11:11 lsvih

Also had this issue when migrating a site which was making requests on the same subdomain to a different domain.

The above fix worked with the interceptor but it would be nice to diagnose what is actually going wrong.

As above it just happens in https chrome, but works in all other browsers and non secure chrome.

AlexCW avatar Jan 13 '17 14:01 AlexCW

Please try the latest v1.2.0

steffans avatar Feb 09 '17 08:02 steffans