gpt4 book ai didi

curl - 向服务器发送请求时如何查看curl发出的请求头?

转载 作者:行者123 更新时间:2023-12-05 07:53:32 25 4
gpt4 key购买 nike

我想在向服务器发送请求时查看 curl 生成的请求 header 。我该如何检查?

最佳答案

我认为 curl --verbose/-v 是最简单的。它将吐出请求 header (以'>'为前缀的行)而无需写入文件:

$ curl -v -I -H "Testing: Test header so you see this works" http://stackoverflow.com/
* About to connect() to stackoverflow.com port 80 (#0)
* Trying 69.59.196.211... connected
* Connected to stackoverflow.com (69.59.196.211) port 80 (#0)
> HEAD / HTTP/1.1
> User-Agent: curl/7.16.3 (i686-pc-cygwin) libcurl/7.16.3 OpenSSL/0.9.8h zlib/1.2.3 libssh2/0.15-CVS
> Host: stackoverflow.com
> Accept: */*
> Testing: Test header so you see this works
>
< HTTP/1.0 200 OK
...

关于curl - 向服务器发送请求时如何查看curl发出的请求头?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32520145/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com