HTTPie

I can never remember how to use CURL. Whenever I want to send some data I end up having to use google or try and dig through the terrible man pages. LMGTFY

Today I leanred about a new tool called HTTPie. HTTPie is a command line tool that is way easier to use and understand than CURL.

Install it on the Mac

Post some data with CURL.

The equivalent using HTTP Pie. The == operator is used to indicate a query string parameter.

Often as developers, we are testing code against localhost. Fortunately, there is a shorthand syntax for this common occurrence.

Want to post a file? Use standard Unix pipes

Since JSON is commonly used during REST operations HTTP Pie helps us with that as well.

Suppose we want to send a document as shown below.

by using the = sign we can tell HTTP Pie to construct the document.

HTTP Pie will add the default encoding for JSON

Its even possible to create nested JSON structures such as

The above example from the HTTP Pie documentation is constructed using

The := operator is used for nonstring values and when you would like to embed a JSON file into the request.

Ever want to post a form with CURL? LMGTFY

The below is the equivalent with HTTP Pie

I never knew about this tool before today. In the past, I would resort to browser plugins like PostMan in order to make testing my services easier. Now that I know about HTTP Pie, I think I will try and make use of it more often.

Post by Jeffrey Ellin

You may also like...