httpie / cli

🥧 HTTPie CLI — modern, user-friendly command-line HTTP client for the API era. JSON support, colors, sessions, downloads, plugins & more.
https://httpie.io
BSD 3-Clause "New" or "Revised" License
32.67k stars 3.68k forks source link

Embed json in a query string #1578

Open musjj opened 1 month ago

musjj commented 1 month ago

Checklist


Enhancement request

Embed JSON in a query string for GET requests.


Problem it solves

I'm trying to use the httpie CLI tool to quickly test out my tRPC backend and it works well for POST requests. But for GETs, tRPC requires you to embed the data as a JSON string in a query param like this:

myQuery?input=${encodeURIComponent(JSON.stringify(input))}

It would be nice if there's a syntax that can support this kind of use case. Maybe it can look something like this:

http GET https://localhost:3000/myQuery input[foo]===bar
GET myQuery?input=%7B%22foo%22%3A%22bar%22%7D HTTP/1.1