mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 02:44:02 +00:00
Merge remote-tracking branch 'upstream/main' into fix/terrain-heights-bounds
main now rejects out-of-range coordinates at the proxy itself (19fcc00b), the
same check this branch added. main's version is kept, and the changelog entry
no longer claims that part; the cache cap, file ceiling and rate limit remain.
This commit is contained in:
commit
202a310c7a
581 files changed
+91709
-2561
No files matched your search
@@ -2,6 +2,7 @@ import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { parseTerrainPoints } from './data/terrainHeightsProxy.js';
|
||||
import { readResponseTextCapped, coalesceProxyRequest } from './sources/httpBody.js';
|
||||
import { makeRateLimiter, clientKey } from '../server/providers/common/rate-limit.js';
|
||||
|
||||
@@ -176,3 +177,18 @@ test('ADSBDB retains validation and missing-aircraft semantics', async () => {
|
||||
assert.equal(absent.status, 200);
|
||||
assert.deepEqual(JSON.parse(absent.body), { found: false });
|
||||
});
|
||||
|
||||
for (const preview of [false, true]) {
|
||||
test(`terrain server rejects out-of-range points before upstream resolution in ${preview ? 'preview' : 'development'}`, async () => {
|
||||
let calls = 0;
|
||||
const app = fixture('terrainHeightsProxy', { parseTerrainPoints,
|
||||
resolveTerrainHeightRequest: async () => { calls++; return { status: 200, body: { results: [] } }; },
|
||||
}, preview);
|
||||
for (const points of ['181,0', '-181,0', '0,91', '0,-91', '1,2;0,91']) {
|
||||
assert.equal((await app.request('/?points=' + encodeURIComponent(points))).status, 400);
|
||||
}
|
||||
assert.equal(calls, 0);
|
||||
assert.equal((await app.request('/?points=-180,-90;180,90')).status, 200);
|
||||
assert.equal(calls, 1);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user