Hacker News new | ask | show | jobs
by pimlottc 874 days ago
To threadjack a bit - is there a good tool to /minimize/ a curl command? E.g. when you copy a request from your browser's developer mode, it's a giant command line with every single header and option. But most of them aren't strictly necessary.

Rather than stripping them out by hand and manually checking to see if the request still works, it would be nice to have a tool that helped automate this. Obviously it wouldn't work for every site but it would be very helpful.

1 comments

Simple way would be to add a “curl” target. Looks like you’d just need to write up a method that matches this Request interface [0] to some curl command substrings you mash together.

Problem is of course: the headers and options are all going to be included. You could make it so it organizes them better though, maybe indenting and grouping like-options together so it’s easier to remove stuff. Working with a IR of a network request was a good choice by the author!

[0] https://github.com/curlconverter/curlconverter/blob/e4b6fb74...