| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,8 @@ | |||
| 15 | 15 | "semi": [ | |
| 16 | 16 | 2, | |
| 17 | 17 | "always" | |
| 18 | - ] | ||
| 18 | + ], | ||
| 19 | + "no-console": 0 | ||
| 19 | 20 | }, | |
| 20 | 21 | "env": { | |
| 21 | 22 | "es6": true, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,8 +1,7 @@ | |||
| 1 | 1 | { | |
| 2 | 2 | "rules": { | |
| 3 | 3 | "no-undef": 0, | |
| 4 | - "no-unused-vars": 0, | ||
| 5 | - "no-console": 0 | ||
| 4 | + "no-unused-vars": 0 | ||
| 6 | 5 | }, | |
| 7 | 6 | "plugins": [ | |
| 8 | 7 | "markdown" | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,22 @@ | |||
| 1 | + "use strict"; | ||
| 2 | + import hello from "./hello"; | ||
| 3 | + import nosniff from "./nosniff"; | ||
| 4 | + import assert from "assert"; | ||
| 5 | + import connect from "connect"; | ||
| 6 | + import http from "http"; | ||
| 7 | + import fetch from "node-fetch"; | ||
| 8 | + const responseText = "response text"; | ||
| 9 | + var app = connect(); | ||
| 10 | + app.use(nosniff()); | ||
| 11 | + app.use(hello(responseText)); | ||
| 12 | + | ||
| 13 | + var server = http.createServer(app).listen(3000, () => { | ||
| 14 | + fetch("http://localhost:3000") | ||
| 15 | + .then(res => res.text()) | ||
| 16 | + .then(text => { | ||
| 17 | + assert.equal(text, responseText); | ||
| 18 | + server.close(); | ||
| 19 | + }).catch(console.error.bind(console)); | ||
| 20 | + }); | ||
| 21 | + | ||
| 22 | + | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,12 +1,12 @@ | |||
| 1 | 1 | // LICENSE : MIT | |
| 2 | 2 | "use strict"; | |
| 3 | 3 | import assert from "power-assert"; | |
| 4 | - import connect from "connect" | ||
| 4 | + import connect from "connect"; | ||
| 5 | 5 | import nosniff from "../../src/connect/nosniff"; | |
| 6 | 6 | import hello from "../../src/connect/hello"; | |
| 7 | 7 | import http from "http"; | |
| 8 | 8 | import fetch from "node-fetch"; | |
| 9 | - describe("hello", function () { | ||
| 9 | + describe("connect", function () { | ||
| 10 | 10 | var responseText = "test"; | |
| 11 | 11 | var server; | |
| 12 | 12 | before(function (done) { | |
@@ -18,17 +18,21 @@ describe("hello", function () { | |||
| 18 | 18 | after(function () { | |
| 19 | 19 | server.close(); | |
| 20 | 20 | }); | |
| 21 | - it("should return response text", function () { | ||
| 22 | - return fetch("http://localhost:3000") | ||
| 23 | - .then(res => res.text()) | ||
| 24 | - .then(text => { | ||
| 25 | - assert.equal(text, responseText); | ||
| 26 | - }); | ||
| 21 | + describe("hello", function () { | ||
| 22 | + it("should return response text", function () { | ||
| 23 | + return fetch("http://localhost:3000") | ||
| 24 | + .then(res => res.text()) | ||
| 25 | + .then(text => { | ||
| 26 | + assert.equal(text, responseText); | ||
| 27 | + }); | ||
| 28 | + }); | ||
| 27 | 29 | }); | |
| 28 | - it("should return response has `X-Content-Type-Options` header", function () { | ||
| 29 | - return fetch("http://localhost:3000") | ||
| 30 | - .then(res => { | ||
| 31 | - assert.equal(res.headers.get("x-content-type-options"), "nosniff"); | ||
| 32 | - }) | ||
| 30 | + describe("sniff", function () { | ||
| 31 | + it("should return response has `X-Content-Type-Options` header", function () { | ||
| 32 | + return fetch("http://localhost:3000") | ||
| 33 | + .then(res => { | ||
| 34 | + assert.equal(res.headers.get("x-content-type-options"), "nosniff"); | ||
| 35 | + }); | ||
| 36 | + }); | ||
| 33 | 37 | }); | |
| 34 | 38 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments