Skip to content

Commit

Permalink
cfworker 小调整
Browse files Browse the repository at this point in the history
  • Loading branch information
EtherDream committed Jul 12, 2019
1 parent 7c0a3df commit 8a3fb1d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions cf-worker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
*/
const ASSET_URL = 'https://zjcqoo.github.io'

const JS_VER = 8
const JS_VER = 9
const MAX_RETRY = 1


/** @type {RequestInit} */
const PREFLIGHT_INIT = {
status: 204,
headers: new Headers({
Expand All @@ -22,7 +22,7 @@ const PREFLIGHT_INIT = {
/**
* @param {string} message
* @param {number} status
* @param {any} headers
* @param {Object<string, string>} headers
*/
function makeRes(message, status = 200, headers = {}) {
headers['cache-control'] = 'no-cache'
Expand All @@ -39,7 +39,10 @@ addEventListener('fetch', e => {
})


function fetchHandler(e) {
/**
* @param {FetchEvent} e
*/
async function fetchHandler(e) {
const req = e.request
const urlStr = req.url
const urlObj = new URL(urlStr)
Expand All @@ -66,11 +69,10 @@ function fetchHandler(e) {
}



/**
* @param {Request} req
*/
async function httpHandler(req) {
function httpHandler(req) {
const reqHdrRaw = req.headers
if (reqHdrRaw.has('x-jsproxy')) {
return Response.error()
Expand Down

0 comments on commit 8a3fb1d

Please sign in to comment.