How to Add a Header to a curl Request

Date:

Share post:

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' \
 'https://nft.api.cx.metamask.io/collections?chainId=1' \
 -H 'accept: application/json' \
 -H 'Version: 1'

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

Request Metrics real user monitoring
Request Metrics real user monitoring
Request Metrics real user monitoring
  • Page Visibility API

    Page Visibility API

    One event that’s always been lacking within the document is a signal for when the user is looking at a given tab, or another tab. When does the user switch off our site to look at something else? When do they come back?

  • 39 Shirts – Leaving Mozilla

    39 Shirts – Leaving Mozilla

    In 2001 I had just graduated from a small town high school and headed off to a small town college. I found myself in the quaint computer lab where the substandard computers featured two browsers: Internet Explorer and Mozilla. It was this lab where I fell…

  • Implement jQuery’s hover() Method in MooTools

    Implement jQuery’s hover() Method in MooTools

    jQuery offers a quick event shortcut method called hover that accepts two functions that represent mouseover and mouseout actions. Here’s how to implement that for MooTools Elements. The MooTools JavaScript We implement hover() which accepts to functions; one will be called on mouseenter and the other…

  • MooTools Typewriter Effect Plugin

    MooTools Typewriter Effect Plugin

    Last week, I read an article in which the author created a typewriter effect using the jQuery JavaScript framework. I was impressed with the idea and execution of the code so I decided to port the effect to MooTools. After about an hour of coding…


Source link
spot_img

Related articles

How Smart Event Registration Forms Prevent Attendee Drop-Offs

A corporate training event lost 40% of its expected attendees because the registration form asked for a “department...

I’m So Old: Web Edition

Time can be a funny thing. I still remember discovering HTML, CSS, and JavaScript coding. I still remember...

Suspect in Minnesota Shooting Linked to Security Company, Evangelical Ministry

A man named Vance Boelter allegedly shot and killed Melissa Hortman, a Democratic Minnesota state representative, and her...

Switch 2’s Best-Selling eShop Games So Far

It's now been more than a week since the arrival of the Switch 2, so we've taken another...