v3 getZxy response is object with optional cacheControl, expires [#24]

This commit is contained in:
Brandon Liu
2022-10-03 13:57:59 +08:00
parent 87bf3994d0
commit 92c1c8bbdf
2 changed files with 52 additions and 26 deletions

View File

@@ -14,6 +14,7 @@ import {
Cache,
BufferPosition,
Source,
Response,
VersionMismatch,
PMTiles,
} from "./v3";
@@ -134,10 +135,10 @@ class TestNodeFileSource implements Source {
async getBytes(
offset: number,
length: number
): Promise<[ArrayBuffer, string?]> {
): Promise<Response> {
const slice = new Uint8Array(this.buffer.slice(offset, offset + length))
.buffer;
return [slice, this.etag];
return {data:slice, etag:this.etag};
}
}
@@ -283,6 +284,7 @@ test("pmtiles get metadata", async (assertion) => {
assertion.ok(metadata.name);
});
// echo '{"type":"Polygon","coordinates":[[[0,0],[0,1],[1,0],[0,0]]]}' | ./tippecanoe -zg -o test_fixture_2.pmtiles
test("pmtiles handle retries", async (assertion) => {
const source = new TestNodeFileSource("test_fixture_1.pmtiles", "1");
source.etag = "1";