Remove redundant try block in Cyclone's fetch

The error handling in the catch block led to a bug where the request's
body was piped to Cyclone's response. However, since the mock request in
the catch block doesn't have a body property, let alone a pipe method,
that line throws an error.
This commit is contained in:
CountBleck 2022-08-30 10:35:54 -07:00
parent 1e932d9518
commit 4ec92aec50

View file

@ -51,15 +51,7 @@ async function fetchBare(url, res, req) {
},
}
try {
var request = await fetch(url.href, options);
} catch (e) {
var request = {
text() {
return 'Error: ' + e;
},
}
}
var request = await fetch(url.href, options);
try {
var contentType = request.headers.get('content-type') || 'application/javascript'