Basic curl & CORS Test & Preflight

Yiling Liu
1 min readOct 20, 2019

--

curl is a pretty powerful tool which allows you to test endpoints.

  • -X allows you to override method
  • -o, --outputWrite output to file
  • -I, --head Fetch the headers only!
  • -H, --header Include header.

CORS: cross origin resource sharing.

curl --verbose \-X POST https://us-central1-barnard-yiddish.cloudfunctions.net/addSuggestions \-H 'content-type: application/json' \-H "Origin: https://google.com/" \-d '{"english_word": "sun","translation": "太阳","transliteration": "taiyang","sound_link": "https://gcs/eiuDklsXy.mp3"}'

If the return contains

Access-Control-Allow-Origin

Access-Control-Allow-Methods

Access-Control-Allow-Headers

Then it’s a good endpoint which allows CORS.

--

--

Yiling Liu
Yiling Liu

Written by Yiling Liu

Creative Technologist, ex-googler

No responses yet