cli icon indicating copy to clipboard operation
cli copied to clipboard

Mechanism to pass custom headers before URL

Open sensibleish opened this issue 8 years ago • 3 comments

The input format for custom headers (http URL customer-header customer-header...) is very strange compared to cURL. cURL offers -H for custom headers. This makes it easy to define presets (like bash aliases) that include headers. I'm not a bash expert, but there doesn't seem to be an easy way to do that with http.

sensibleish avatar Jul 19 '16 03:07 sensibleish

This should work (in bash):

function myhttp {
    http "$@" 'Foobar:asdf'
}

The order in which the REQUEST_ITEMs are specified doesn't matter. Although I have to admit that I didn't hit on this immediately and wrote a fancy script that mangled the METHOD/URL parameters :smile:

Perhaps this would be worth documenting somewhere (in case it isn't already).

MazeChaZer avatar Nov 10 '16 19:11 MazeChaZer

Having custom headers before url also allows you to edit url easily from bash history. You don't have to move left to url to edit the url endpoint.

az-pz avatar Jun 19 '18 19:06 az-pz

Also dropping by to voice support for this feature.

ddevault avatar Jun 24 '19 16:06 ddevault