tiny-helpers icon indicating copy to clipboard operation
tiny-helpers copied to clipboard

Add Curl to Fetch

Open revolunet opened this issue 2 years ago • 4 comments

Thank you for opening a pull request to tiny-helpers.dev ❤️

Before you submit your PR, please take a look at the contributing guidelines. :)

To make it easier for us to review and merge your PR, please make sure …

  • [x] you only add one (!) new helper per pull request.
  • [x] you have checked if an open PR already exists.
  • [x] the submitted website is focused on a single, development related issue.
  • [x] the desc field includes an "actionable sentence" (e.g. "Create something great" or "Transform something into something else").

Thank you! 🙇‍♂️

revolunet avatar Mar 17 '22 01:03 revolunet

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/stefanjudis/tiny-helpers/4WBLH8DQa3s5eonFkhiSCEVXFYNi
✅ Preview: https://tiny-helpers-git-fork-revolunet-patch-1-stefanjudis.vercel.app

vercel[bot] avatar Mar 17 '22 01:03 vercel[bot]

@revolunet welcome to Tiny Helpers and thanks a bunch for contributing! :)

Quick question, why did you remove the other file?

I'm happy to accept your Tiny Helper and just FYI, it doesn't seem to pick up all options yet. :)

image

stefanjudis avatar Mar 17 '22 06:03 stefanjudis

my bad for the other file, another PEBCAK issue :)

not my tool but could you please paste you curl command as text so i can have a try ?

revolunet avatar Apr 01 '22 13:04 revolunet

Here we go:

curl 'https://fooo.stefanjudis.com/api/collect' -X POST -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:98.0) Gecko/20100101 Firefox/98.0' -H 'Accept: */*' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate, br' -H 'Referer: https://www.stefanjudis.com/' -H 'Content-Type: application/json' -H 'Origin: https://www.stefanjudis.com' -H 'DNT: 1' -H 'Connection: keep-alive' -H 'Sec-Fetch-Dest: empty' -H 'Sec-Fetch-Mode: cors' -H 'Sec-Fetch-Site: same-site' -H 'Save-Data: on' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' -H 'TE: trailers' --data-raw '{"type":"pageview","payload":{"website":"xxx","hostname":"www.stefanjudis.com","screen":"1920x1080","language":"en-US","url":"/","referrer":""}}'

That's just one of the calls included on my site. 🙈

FYI – fetch is not category on Tiny Helpers. So I think HTTP, Command Line and JavaScript are the best options. :)

All that said, I'd be cool if the helper could translate all curl options. WDYT?

stefanjudis avatar Apr 06 '22 08:04 stefanjudis