fix(server): declare Allow: GET on the new 405 responses

RFC 9110 section 15.5.6 requires a 405 to name the methods it accepts, and
/api/radio/stations already does this in-tree. Thanks to kvnloo for catching it
on review. The same gap on the pre-existing handlers is tracked in #809 and is
deliberately left alone here.
This commit is contained in:
daikaginza committed 2026-09-29 10:56:20 +07:00
1 parent fb6b4e34f0
commit 2e5dfce1af
6 files changed
+15 -4

No files matched your search

+4 -1
View File
@@ -71,7 +71,10 @@ export function adsbLolProxy() {
// Read-only snapshot endpoint; match the method contract its sibling
// query proxies already declare instead of serving every verb alike.
if (req.method !== 'GET') {
res.writeHead(405, { 'Content-Type': 'application/json' });
res.writeHead(405, {
'Content-Type': 'application/json',
Allow: 'GET',
});
res.end(JSON.stringify({ error: 'Method Not Allowed' }));
return;
}
+4 -1
View File
@@ -354,7 +354,10 @@ export function openSkyProxy() {
// /api/geocode and the other query proxies state it, rather than
// answering any verb with the same body and ignoring the request body.
if (req.method !== 'GET') {
res.writeHead(405, { 'Content-Type': 'application/json' });
res.writeHead(405, {
'Content-Type': 'application/json',
Allow: 'GET',
});
res.end(JSON.stringify({ error: 'Method Not Allowed' }));
return;
}
+1 -1
View File
@@ -230,7 +230,7 @@ export function installRouteMiddleware(
// The documented shape above is a GET with query parameters; say so,
// the way the other query proxies do, instead of answering any verb.
if (req.method !== 'GET') {
res.writeHead(405, { 'Content-Type': 'application/json' });
res.writeHead(405, { 'Content-Type': 'application/json', Allow: 'GET' });
res.end(JSON.stringify({ error: 'Method Not Allowed' }));
return;
}