在XMLHttpRequest中获取SENT头文件 [英] get SENT headers in an XMLHttpRequest

查看:172
本文介绍了在XMLHttpRequest中获取SENT头文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图从XHR对象获取Request头,但没有运气,是否有隐藏的方法或对象的属性,将公开由浏览器发送的头文件?



我已经知道如何设置自定义请求标题并查看响应标题,我正在寻找所有发送的REQUEST标题列表,由浏览器和我的自定义标题创建。



我使用的是webkit / chrome,并不关心其他浏览器。

编辑:我不想监视请求,我正在构建一个Web应用程序,我需要列出这些标题并在应用程序中显示它们,请不要告诉我关于提琴手,萤火虫和镀铬工具,这不是我要找的。

解决方案

XMLHttpRequest API 以获取发送的请求标头。有些方法只能获取响应头信息, set 请求头信息。



您必须让服务器回显标题,或者使用像Wireshark这样的数据包嗅探器。


Trying to get the Request headers from the XHR object, but with no luck, is there a hidden method or property of that object that will expose the headers sent by the browser?

I already know how to set custom request headers and view the response headers, I'm looking to get a list of all REQUEST headers sent, ones created by the browser and my custom ones.

I'm using webkit/chrome, don't care about other browsers.

EDIT: I'm not looking to monitor the request, I'm building a web app and I need to list those headers and display them within the app, please don't tell me about fiddler, firebug and chrome tools, that's not what I'm looking for.

解决方案

There is no method in the XMLHttpRequest API to get the sent request headers. There are methods to get the response headers only, and set request headers.

You'll have to either have the server echo the headers, or use a packet sniffer like Wireshark.

这篇关于在XMLHttpRequest中获取SENT头文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆