This is an example call of @stevekrouse/insecureFetch

import { insecureFetch } from "";
const url = "";
const data = await insecureFetch(url);
const text = await data.text();
👆 This is a val. Vals are TypeScript snippets of code, written in the browser and run on our servers. Create scheduled functions, email yourself, and persist small pieces of data — all from the browser.
easrng avatar

Cloudflare workers doesn't validate https certs???

stevekrouse avatar

Apparently not!

vladimyr avatar

I assume it supports only GET requests?

stevekrouse avatar

I think it's a pretty naive proxy that supports anything, why do you ask, @vladimyr?

vladimyr avatar

I didn't have any particular use case in mind just curious to know what to write next to it in my notes :)

vladimyr avatar

And to answer my question, no POST requests aren't supported:

$ curl -s '' -F'foo=bar' # works
$ curl -s '' -F'foo=bar' # returns 405 Method Not Allowed
vladimyr avatar

Also, keep in mind that you need to URL encode url param:

$ curl -s '' | jq -c '.args'
# ==> {"foo":"bar"}
$ curl -s '' | jq -c '.args'
# ==> {"baz":"42","foo":"bar"}

In @stevekrouse's example: query is consumed by proxied URL but fieldsand rows get consumed by proxy instead ⚠️

stevekrouse avatar

It should now support POST requests and everything else – it forwards the whole req with the url changed.

I also made a helper method: @stevekrouse/insecureFetch

And include the source on the fetch's homepage: