Skip to content

Instantly share code, notes, and snippets.

Last active November 29, 2019 02:54
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
addEventListener('fetch', event => {
async function handleRequest(request) {
const url = request.url + (request.url.indexOf('?')===-1 ? '?' : '&')
const hook1Response = await fetch(url + 'workers_proxy_get=1', request)
let api = await hook1Response.text()
return new Response(api, hook1Response);
let apiResponse = await fetch(api)
apiResponse = await apiResponse.text()
let formData = new FormData()
formData.set('html', apiResponse)
return fetch(url + 'workers_proxy_response=1',
{ headers: request.headers, method:"POST", body:formData })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment