[英]Chrome extension - getting Content-Type in onBeforeRequest
In a chrome extension I need to know what is the Content-Type of the request in onBeforeRequest
callback, because if the Content-Type is application/x-www-form-urlencoded
I want to decode the data in requestBody
. 在chrome扩展程序中,我需要知道
onBeforeRequest
回调中请求的Content-Type是什么,因为如果Content-Type是application/x-www-form-urlencoded
我想对requestBody
的数据进行解码。 however according to the life cycle documentation ( https://developer.chrome.com/extensions/webRequest ) the http headers are not yet available during onBeforeRequest
, so I don't know what is the Content-Type. 但是,根据生命周期文档( https://developer.chrome.com/extensions/webRequest),http头在
onBeforeRequest
期间尚不可用,因此我不知道什么是Content-Type。 is there a way to know if the data is url-encoded during onBeforeRequest
? 有没有办法知道在
onBeforeRequest
期间数据是否经过url编码?
This is not possible at the time you desire. 在您想要的时候这是不可能的。
webRequest.onBeforeRequest
fires prior to the request being made. webRequest.onBeforeRequest
在发出请求之前触发。 The data you want is something that is provided by the server in response to the request. 所需的数据是服务器响应请求提供的数据。 You are looking for header information.
您正在寻找标题信息。 The earliest this is available is in the
webRequest.onHeadersReceived
event. 最早可用的是在
webRequest.onHeadersReceived
事件中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.