Skip to content

Commit

Permalink
Fix Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaokaixuan authored Aug 4, 2023
1 parent 7eabd73 commit 67daf00
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cf-worker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async function handleRequest(event) {
// 发起 fetch
let fr = (await fetch(url, fp));
outCt = fr.headers.get('content-type');
if(outCt.includes('application/text') || outCt.includes('text/html')) {
if(outCt && (outCt.includes('application/text') || outCt.includes('text/html'))) {
try {
// 添加base
let newFr = new HTMLRewriter()
Expand All @@ -89,6 +89,9 @@ async function handleRequest(event) {
} catch(e) {
}
}
for (const [key, value] of fr.headers.entries()) {
outHeaders.set(key, value);
}
outStatus = fr.status;
outStatusText = fr.statusText;
outBody = fr.body;
Expand Down

0 comments on commit 67daf00

Please sign in to comment.