View AJAX response content in Chrome developer tools?

后端 未结 9 590
忘掉有多难
忘掉有多难 2020-12-02 17:04

Traditionally I use FireBug to debug my AJAX requests. It lets you examine both the contents of your request as well as the response that was sent back from the server. (it

9条回答
  •  余生分开走
    2020-12-02 17:15

    The reason can be not only in chrome, but also preview can be stopped even by JS code. For example, there is some plugin for Vue.js called vue-resorcese, and it had this issue: Chrome, no response data after OPTIONS request? I lived with this issue several months until found that question today. Current question never gave an answer, so I now share it here.

    Details: this plugin had next code that creates XHR object:

    if ('responseType' in xhr && SUPPORTS_BLOB) {
           xhr.responseType = 'blob';
    }
    

    This code was ok and preview worked but until some chrome update. Today when I commented this away, preview appeared again! So first, try check your XHR wrapper, may be it has something like this.

    It was the rare issue because it was reproduced only with CORS preflight. BTW right clicking on the OPTIONS XHR and REPLAY also showed preview.

    there you have it

提交回复
热议问题