mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-11 13:52:19 +00:00
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:
1 parent
fb6b4e34f0
commit
2e5dfce1af
6 files changed
+15
-4
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user