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

req.acceptsCharsets.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
import { opine } from "../../mod.ts";import { superdeno } from "../deps.ts";import { describe, it } from "../utils.ts";
describe("req", function () { describe(".acceptsCharsets(type)", function () { describe("when Accept-Charset is not present", function () { it("should return true", function (done) { const app = opine();
app.use(function (req, res, next) { res.end(req.acceptsCharsets("utf-8") ? "yes" : "no"); });
superdeno(app) .get("/") .expect("yes", done); }); });
describe("when Accept-Charset is present", function () { it("should return true", function (done) { const app = opine();
app.use(function (req, res, next) { res.end(req.acceptsCharsets("utf-8") ? "yes" : "no"); });
superdeno(app) .get("/") .set("Accept-Charset", "foo, bar, utf-8") .expect("yes", done); });
it("should return false otherwise", function (done) { const app = opine();
app.use(function (req, res, next) { res.end(req.acceptsCharsets("utf-8") ? "yes" : "no"); });
superdeno(app) .get("/") .set("Accept-Charset", "foo, bar") .expect("no", done); }); }); });});
opine

Version Info

Tagged at
2 years ago