How to map response to request when using “http-on-modify-request” and “http-on-examine-response”?

若如初见. 提交于 2019-12-05 02:44:50

问题


How to map incoming responses to the outgoing requests when using HTTP observers: https://developer.mozilla.org/en/Setting_HTTP_request_headers#Observers ?


回答1:


Compare nsIHttpChannel objects, like HttpFox does:

getPendingRequestForRequestEvent: function(request) {
   // check for matching request
   for (var i = 0; i < this.Requests.length; i++) {
      if (request.HttpChannel === this.Requests[i].HttpChannel) {
         return i;
      }
   }

   // no match found
   return -1;
},


来源:https://stackoverflow.com/questions/3872773/how-to-map-response-to-request-when-using-http-on-modify-request-and-http-on

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!