fix(server): declare the method contract on the three read-only query proxies

/api/opensky, /api/adsblol/mil and /api/route answered any verb with the same
body while ignoring the request entirely. Measured against a running server
before the change: POST /api/opensky returned 200 with 833,759 bytes of live
state vectors, POST /api/adsblol/mil returned 47,372 bytes. Their siblings do
not: /api/geocode, /api/weather and /api/transit answer 405, and /api/overpass
is deliberately POST-only.

These three are read-only query proxies, so they now answer 405 to anything but
GET, using the wording and shape /api/geocode already uses. The refusal comes
first, before rate limiting and before any upstream call, which the tests
assert by stubbing fetch to throw.

Scope, stated plainly: this is a consistency and intent fix. No rate limiter
was being bypassed — /api/route already limits every request regardless of
verb, and the two aircraft routes have no limiter at all, only 9s and 12s
server-side caches that bound upstream cost for any method.

One existing fixture in src/search/geospatial.test.mjs built a request without
a method, which a real Node request always has; it now sets GET.

Verified on a running server after the change: GET still 200 on all three,
POST 405 on all three, /api/overpass and the other proxies unchanged.
Suite goes from 5090 to 5092 tests, 0 failures.
This commit is contained in:
daikaginza committed 2026-09-29 10:52:26 +07:00
1 parent e7707d9a0f
commit b09db55149
7 files changed
+70 -1

No files matched your search

+5 -1
View File
@@ -209,7 +209,11 @@ test('routing middleware uses configured OSRM servers while retaining request bo
const request = async (query) => {
let payload;
await handler(
{ url: `/?${query}`, socket: { remoteAddress: '127.0.0.1' } },
{
url: `/?${query}`,
method: 'GET',
socket: { remoteAddress: '127.0.0.1' },
},
{
writeHead() {},
end(body) {