Two years ago

Changelog #0009 — 🌊 export cURL, HAR, and 30+ other formats

New year, new features! Over the past week, we’ve been primarily focusing on our overall architecture and under the hood improvements that will unlock work throughout the year. In addition to that, we’ve got a couple of user-visible goodies ready for you as well.

Check out what's new 👇

HTTPie for Web & Desktop

📦 cURL command generation, and more

HTTPie command generation has been available in the preview panel for a while. You can now export code and commands for many other languages and tools, including the highly requested cURL, HAR, JavaScript, Node, Java, PHP, Objective-C, Swift, Python, Ruby, C#, Go, OCaml, and more.

HTTPie cURL export

Open the preview and select the export format you like. Make some changes to your request and see them instantly reflected in the code preview — it’s like a WYSIWYG editor for API calls code. Hit the three dots at the right, copy the generated code to export and share. Easy!

✨ Improvements

  • Small improvements and optimizations.

HTTPie for Terminal

We have been working towards the upcoming 3.0.0 release of HTTPie for Terminal that will come out very soon. Here’s what’s new in the development version:

🌲 More robust and user-friendly nested JSON syntax

The nested JSON syntax extends the HTTPie request language and through its compactness and expressiveness offers a productivity boost when talking to JSON APIs. It allows you to craft complex JSON structures without worrying about curly braces, quotes, or backlashes.

This syntax, together with the rest of the HTTPie language, will eventually find its way to HTTPie for Web & Desktop as well, so we wanted to make extra sure it’s up to HTTPie’s standards before we release it to the wild.

With the help of our users, we identified various edge cases and ended up re-writing the underlying implementation to be much more robust. On the more user-visible side, we now offer guiding syntax and type errors instead of silently accepting the broken input, for example:

Unbalanced brackets

$ http --offline --print=B  pie.dev/post "foo[bar]=baz" "foo[quux:=1"
HTTPie Syntax Error: Expecting ']'

foo[quux
        ^

Omitted brackets

$ http --offline --print=B  pie.dev/post "foo[bar]baz[quux]:=2"
HTTPie Syntax Error: Expecting '['

foo[bar]baz[quux]
        ^^^

Type errors

$ http --offline --print=B  pie.dev/post "foo[bar]=baz" "foo[1]:=2"
HTTPie Type Error: Can't perform 'index' based access on 'foo' which has a type of 'object' but this operation requires a type of 'array'.

foo[1]
   ^^^

Happy testing, and see you next week!