This commit is contained in:
+12
-1
@@ -169,7 +169,18 @@ function isSuccessfulUpstream({ err, stdout }) {
|
||||
const lastNewline = stdout.lastIndexOf("\n");
|
||||
const statusStr = lastNewline >= 0 ? stdout.substring(lastNewline + 1).trim() : "";
|
||||
const status = parseInt(statusStr) || 0;
|
||||
return status >= 200 && status < 400;
|
||||
if (status < 200 || status >= 400) return false;
|
||||
|
||||
const body = lastNewline >= 0 ? stdout.substring(0, lastNewline) : stdout;
|
||||
const trimmed = body.trimStart();
|
||||
// Some upstream edges return the Angular shell as HTTP 200 for API
|
||||
// paths on the direct transport. Treat that as a failed API response so
|
||||
// the fallback transport can fetch the JSON payload.
|
||||
if (trimmed.startsWith("<!DOCTYPE html") || trimmed.startsWith("<html")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function respondWithCurlResult({ err, stdout }, res) {
|
||||
|
||||
Reference in New Issue
Block a user