update tests
This commit is contained in:
21
test/forbid/forbid.js
Normal file
21
test/forbid/forbid.js
Normal file
@ -0,0 +1,21 @@
|
||||
'use strict'
|
||||
const test = require('tape')
|
||||
const request = require('req-then')
|
||||
const LocalWebServer = require('../../')
|
||||
const c = require('../common')
|
||||
|
||||
test('forbid', function (t) {
|
||||
t.plan(2)
|
||||
const ws = new LocalWebServer()
|
||||
ws.addBlacklist([ '*.php', '*.html' ])
|
||||
ws.addStatic(__dirname)
|
||||
const server = ws.getServer()
|
||||
server.listen(8100, () => {
|
||||
request('http://localhost:8100/two.php')
|
||||
.then(c.checkResponse(t, 403))
|
||||
.then(() => request('http://localhost:8100/one.html'))
|
||||
.then(c.checkResponse(t, 403))
|
||||
.then(server.close.bind(server))
|
||||
.catch(c.fail(t))
|
||||
})
|
||||
})
|
1
test/forbid/one.html
Normal file
1
test/forbid/one.html
Normal file
@ -0,0 +1 @@
|
||||
one
|
1
test/forbid/two.php
Normal file
1
test/forbid/two.php
Normal file
@ -0,0 +1 @@
|
||||
<?php echo "i'm coding PHP templatez!\n" ?>
|
Reference in New Issue
Block a user