Skip to content

ConradIrwin/fetch-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Fetch Worker

A Cloudflare Worker that fetches a GitHub artifact zip file and returns it to the client.

Setup

  1. Install dependencies:

    npm install
  2. Run locally:

    npm run dev
  3. Deploy to Cloudflare:

    npm run deploy

Usage

Once deployed or running locally, simply make a request to your worker URL to fetch the GitHub artifact:

curl http://localhost:8787/broken

This will fail because the token is forwarded to the upstream location.

curl http://localhost:8787/fixed

This will succeed because the token is not forwarded to the upstream location.

Testing against node js

The equivalent functionality is also in ./node.js.

To run with follow redirects using the default node:

node ./node.js default
200

A manual implementation of the correct behaviour:

node ./node.js fixed
200

A manual implementation of the incorrect behaviour that cloudflare workers use:

node ./node.js fixed
200

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published