how do I set a custom header in a curl config file

前端 未结 2 1038
心在旅途
心在旅途 2021-01-13 16:16

How do I add the option for setting a custom header in a curl config file? Neither of the following lines did work:

Header = \'x-abc: xyz\'
header = \'x-abc:         


        
相关标签:
2条回答
  • 2021-01-13 17:16

    Regarding your snippet with the code: you just needed to use double quotes " instead of single quotes '.

    With this change both statements work fine.

    Header = "x-abc: xyz"
    header = "x-abcd: xyz"
    
    0 讨论(0)
  • 2021-01-13 17:18

    -H:"x-abc: xyz" works fine:

    curl -vvv -K headerfile  http://www.google.com -o /dev/null
    * About to connect() to www.google.com port 80 (#0)
    *   Trying 74.125.230.243...
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
    0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* connected
    * Connected to www.google.com (74.125.230.243) port 80 (#0)
    > GET / HTTP/1.1
    > User-Agent: curl
    > Host: www.google.com
    > Accept: */*
    > x-abc: xyz
    

    .....

    0 讨论(0)
提交回复
热议问题