forked from sintaxi/harp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
security.js
42 lines (35 loc) · 1.08 KB
/
security.js
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
var should = require("should")
var request = require('request')
var path = require("path")
var fs = require("fs")
var exec = require("child_process").exec
var harp = require("../")
describe("security", function(){
var projectPath = path.join(__dirname, "apps/security")
var outputPath = path.join(__dirname, "out/security")
var config;
before(function(done){
harp.compile(projectPath, outputPath, function(errors, output){
config = output
var server = harp.server(projectPath)
server.listen(8101, done)
})
})
it("should not serve file starting with underscore", function(done){
request('http://localhost:8101/_secret.txt', function (e, r, b) {
r.statusCode.should.eql(404)
done()
})
})
it("should not serve file starting with encoded underscore", function(done){
request('http://localhost:8101/%5fsecret.txt', function (e, r, b) {
r.statusCode.should.eql(404)
done()
})
})
after(function(done){
exec("rm -rf " + outputPath, function(){
done()
})
})
})