如果我做
curl -v --data "hello" example.com
卷曲發送
POST / HTTP/1.1
Host: example.com
User-Agent: curl/7.77.0
Accept: */*
Content-Length: 5
Content-Type: application/x-www-form-urlencoded
hello
我知道我可以通過-X 'Content-Type: something/else更改 Content-Type 標頭的值,但是有沒有辦法在根本不設定該標頭的情況下發送資料?
uj5u.com熱心網友回復:
要告訴 curl 根本不發送標頭,請使用 傳遞沒有值的標頭-H,如下所示(引號不是絕對必要的):
curl --data hello -H 'Content-Type:' example.com
這將發送此請求:
POST / HTTP/1.1
Host: example.com
User-Agent: curl/7.77.0
Accept: */*
Content-Length: 5
hello
從標志的curl 手冊頁-H:
通過在冒號右側給出不帶內容的替換來洗掉內部標題,如:
-H "Host:". 如果您發送無值的自定義標頭,則其標頭必須以分號結尾,例如-H "X-Custom-Header;"發送“X-Custom-Header:”。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/448367.html
標籤:卷曲
