diff --git a/src/static.ts b/src/static.ts index c0dc6f2f..1942523b 100644 --- a/src/static.ts +++ b/src/static.ts @@ -146,7 +146,7 @@ export class Static { // Range await res - .status(200) + .status(206) .length(end - start + 1) .type(type) .set('Content-Range', `bytes ${start}-${end}/${length}`) diff --git a/test/static-app.js b/test/static-app.js index f17107aa..eefaa212 100644 --- a/test/static-app.js +++ b/test/static-app.js @@ -88,49 +88,49 @@ t.test('Static app', async t => { .bodyLike(/^Hello World!/); (await ua.getOk('/static/hello.txt', {headers: {Range: 'bytes=1-5'}})) - .statusIs(200) + .statusIs(206) .headerExists('Content-Type') .headerExists('Content-Length') .headerIs('Accept-Ranges', 'bytes') .headerLike('Content-Range', /^bytes 1-5\/\d+/) .bodyIs('ello '); (await ua.getOk('/static/hello.txt', {headers: {Range: 'bytes=-5'}})) - .statusIs(200) + .statusIs(206) .headerExists('Content-Type') .headerExists('Content-Length') .headerIs('Accept-Ranges', 'bytes') .headerLike('Content-Range', /^bytes 0-5\/\d+/) .bodyIs('Hello '); (await ua.getOk('/static/hello.txt', {headers: {Range: 'bytes=1-'}})) - .statusIs(200) + .statusIs(206) .headerExists('Content-Type') .headerExists('Content-Length') .headerIs('Accept-Ranges', 'bytes') .headerLike('Content-Range', /^bytes 1-\d+\/\d+/) .bodyLike(/^ello World!/); (await ua.getOk('/static/hello.txt', {headers: {Range: 'bytes=4-'}})) - .statusIs(200) + .statusIs(206) .headerExists('Content-Type') .headerExists('Content-Length') .headerIs('Accept-Ranges', 'bytes') .headerLike('Content-Range', /^bytes 4-\d+\/\d+/) .bodyLike(/^o World!/); (await ua.getOk('/static/hello.txt', {headers: {Range: 'bytes=4-4'}})) - .statusIs(200) + .statusIs(206) .headerExists('Content-Type') .headerExists('Content-Length') .headerIs('Accept-Ranges', 'bytes') .headerLike('Content-Range', /^bytes 4-4\/\d+/) .bodyIs('o'); (await ua.getOk('/static/hello.txt', {headers: {Range: 'bytes=0-0'}})) - .statusIs(200) + .statusIs(206) .headerExists('Content-Type') .headerExists('Content-Length') .headerIs('Accept-Ranges', 'bytes') .headerLike('Content-Range', /^bytes 0-\d+\/\d+/) .bodyIs('H'); (await ua.getOk('/static/hello.txt', {headers: {Range: 'bytes=-'}})) - .statusIs(200) + .statusIs(206) .headerExists('Content-Type') .headerExists('Content-Length') .headerIs('Accept-Ranges', 'bytes')