Web Development Guides

How to Add a Header to a curl Request

How to Add a Header to a curl Request

How to Add a Header to a curl Request


curl is one of those great utilities that’s been around seemingly forever and has endless use cases. These days I find myself using curl to batch download files and test APIs. Sometimes my testing leads me to using different HTTP headers in my requests.

To add a header to a curl request, use the -H flag:

curl -X 'GET' 
 ' 
 -H 'accept: application/json' 
 -H 'Version: 1'

You can add multiple headers with multiple -H uses. Header format is usually [key]: [value].

  • Conquering Impostor Syndrome

    Conquering Impostor Syndrome

    Two years ago I documented my struggles with Imposter Syndrome and the response was immense.  I received messages of support and commiseration from new web developers, veteran engineers, and even persons of all experience levels in other professions.  I’ve even caught myself reading the post…

  • Being a Dev Dad

    Being a Dev Dad

    I get asked loads of questions every day but I’m always surprised that they’re rarely questions about code or even tech — many of the questions I get are more about non-dev stuff like what my office is like, what software I use, and oftentimes…

  • CSS :target

    CSS :target

    One interesting CSS pseudo selector is :target.  The target pseudo selector provides styling capabilities for an element whose ID matches the window location’s hash.  Let’s have a quick look at how the CSS target pseudo selector works! The HTML Assume there are any number of HTML elements with…

  • Create a Simple Slideshow Using MooTools, Part IV: Thumbnails and Captions

Source link

Leave your thought here

Your email address will not be published. Required fields are marked *

Enable Notifications OK No thanks