Open musjj opened 1 month ago
Embed JSON in a query string for GET requests.
GET
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:
POST
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
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 forGET
s, tRPC requires you to embed the data as a JSON string in a query param like this:It would be nice if there's a syntax that can support this kind of use case. Maybe it can look something like this: