cli icon indicating copy to clipboard operation
cli copied to clipboard

Embed json in a query string

Open musjj opened this issue 1 year ago • 0 comments

Checklist

  • [x] I've searched for similar feature requests.

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

musjj avatar May 21 '24 16:05 musjj