« index
Coverage for /Users/kris/q-io/spec/http-apps/partial-range-spec.js : 100%
38 lines |
38 run |
0 missing |
0 partial |
6 blocks |
6 blocks run |
0 blocks missing
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | require("../lib/jasmine-promise"); var Http = require("../../http"); var Apps = require("../../http-apps"); var FS = require("../../fs"); describe("http client and server apps", function () { it("should read a partial range", function () { var fixture = FS.join(module.directory || __dirname, "fixtures", "1234.txt"); var app = new Apps.Chain() .use(Apps.Cap) .use(function () { return Apps.File(fixture); }) .end() return Http.Server(app) .listen(0) .then(function (server) { var port = server.node.address().port; return Http.read({ "url": "http://127.0.0.1:" + port + "/", "headers": { "range": "bytes=1-2" } }, function (response) { return response.status === 206; }) .then(function (content) { expect(content.toString('utf-8')).toEqual('23'); }) .finally(server.stop) }) }); }); |