fix(remote-control): send utf-8 charset for plain text errors
This commit is contained in:
parent
9821efa370
commit
63a879046b
|
|
@ -97,7 +97,7 @@ export function startServer(pi: ExtensionAPI, ctx: ExtensionContext): Promise<Re
|
||||||
const hasValidToken = providedToken && validateToken(providedToken, token);
|
const hasValidToken = providedToken && validateToken(providedToken, token);
|
||||||
|
|
||||||
if (!hasValidSession && !hasValidToken) {
|
if (!hasValidSession && !hasValidToken) {
|
||||||
res.writeHead(403, { "Content-Type": "text/plain" });
|
res.writeHead(403, { "Content-Type": "text/plain; charset=utf-8" });
|
||||||
res.end("Forbidden — valid token required. Use the URL shown in the pi terminal.");
|
res.end("Forbidden — valid token required. Use the URL shown in the pi terminal.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -127,7 +127,7 @@ export function startServer(pi: ExtensionAPI, ctx: ExtensionContext): Promise<Re
|
||||||
});
|
});
|
||||||
res.end(buildHTML(nonce));
|
res.end(buildHTML(nonce));
|
||||||
} else {
|
} else {
|
||||||
res.writeHead(404, { "Content-Type": "text/plain" });
|
res.writeHead(404, { "Content-Type": "text/plain; charset=utf-8" });
|
||||||
res.end("Not found");
|
res.end("Not found");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue