ttfb.sh icon indicating copy to clipboard operation
ttfb.sh copied to clipboard

Add JSON support

Open dbalabka opened this issue 3 years ago • 3 comments

dbalabka avatar Jul 04 '22 14:07 dbalabka

Thanks for your PR - I'm not going to merge it at the moment, because I think a better way of handling this (and other options that are really just custom options to pass to curl) is https://github.com/jaygooby/ttfb.sh/issues/9

I've just pushed up that -o option, but I understand that having a bit of syntactic sugar is nice too. Let me have a think...

jaygooby avatar Jul 04 '22 18:07 jaygooby

👋 Can I ask what it is that you're testing with this, because there are really two changes - the first is that you're measuring TTFB from a POST request and the second is that the payload is JSON.

Currently we only support GET requests, so it's not an unreasonable change...

jaygooby avatar Jul 06 '22 11:07 jaygooby

@jaygooby, thanks for the quick reply! 😃 In my case, I would like to measure performance changes in REST API. As you might know, when we would like to send a JSON payload, we have to use the POST method. When we are providing a payload with -d flag, cURL changes the method to POST, the reason is that most of the server's implementations accept payload only with the POST method even if an endpoint is designed to read the data (similarly to GET method). So, IMO providing an option to send a payload in JSON format would be a handful for developers in case to test read-only endpoints which require such input.

dbalabka avatar Jul 07 '22 07:07 dbalabka