deno.land / x / opine@2.3.4 / test / units / req.stale.test.ts

req.stale.test.ts
نووسراو ببینە
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
39
40
41
42
43
44
45
46
47
48
49
50
51
import { opine } from "../../mod.ts";import { superdeno } from "../deps.ts";import { describe, it } from "../utils.ts";
describe("req", function () { describe(".stale", function () { it("should return false when the resource is not modified", function ( done, ) { const app = opine(); const etag = '"12345"';
app.use(function (req, res) { res.set("ETag", etag); res.send(req.stale); });
superdeno(app) .get("/") .set("If-None-Match", etag) .expect(304, done); });
it("should return true when the resource is modified", function (done) { const app = opine();
app.use(function (req, res) { res.set("ETag", '"123"'); res.send(req.stale); });
superdeno(app) .get("/") .set("If-None-Match", '"12345"') .expect(200, "true", done); });
it("should return true without response headers", function (done) { const app = opine();
app.use(function (req, res) { res.send(req.stale); });
superdeno(app) .get("/") .expect(200, "true", done); }); });});
opine

Version Info

Tagged at
2 years ago