Hacker News new | ask | show | jobs
by codesoap 875 days ago
It was a tradeoff. The solution with "base" is more compact and arguably easier to read. On the other hand, it's easier to filter or manipulate httpipe, if the fields are separated. For example, to filter out all requests to a certain host, independent of port or protocol, one could just use this:

    jq -c 'select(.host == "test.net")' my_stored_results.jsonl
The port of some stored requests can be swapped out like this:

    jq -c '.port = 8080' my_stored_requests.jsonl
In other words: I chose to sacrifice compactness for "ease of tinkering".

However, I was also thinking about specifying an optional/informational "url" field or something similar, which also includes the path; "https://test.net/src" for your example. This field would be ignored by tools, but one could more easily copy things over into curl or a browser for further investigations.

1 comments

Hm yeah I wondered if it might be something like that. I would say that adding an additional field might be the worst option, as then the info could get out of sync somehow. I'd just pick whichever and if it's the combined one have some code to explode it into bits, or keep what you have and have some code to combine it, and maybe print the combined one out in a log line.
Good point. Maybe a small 'hp2url' or 'hp2curl' tool, which takes httpipe input and prints URLs or curl commands for each given request, would be a better solution.