added tests covering #119
Showing
1 changed file
with
28 additions
and
0 deletions
tests/suites/http_status.js
0 → 100644
1 | var server = require('webserver').create(); | ||
2 | var service = server.listen(8090, function (request, response) { | ||
3 | var code = parseInt(/^\/(\d+)$/.exec(request.url)[1], 10); | ||
4 | response.statusCode = code; | ||
5 | response.write(""); | ||
6 | response.close(); | ||
7 | }); | ||
8 | |||
9 | codes = [100, 101, 102, 118, 200, 201, 202, 203, 204, 205, 206, 207, 210, | ||
10 | 300, 301, 302, 303, 304, 305, 307, 310, | ||
11 | 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, | ||
12 | 414, 415, 416, 417, 418, 422, 423, 424, 425, 426, 449, 450, | ||
13 | 500, 501, 502, 503, 504, 505, 507, 509]; | ||
14 | |||
15 | casper.start('http://google.com').each(codes, function(self, code) { | ||
16 | if (code === 100) { | ||
17 | // HTTP 100 is CONTINUE, so don't expect a terminated response | ||
18 | return; | ||
19 | } | ||
20 | this.thenOpen('http://localhost:8090/' + code, function() { | ||
21 | this.test.assertHttpStatus(code); | ||
22 | }); | ||
23 | }); | ||
24 | |||
25 | casper.run(function() { | ||
26 | server.close(); | ||
27 | this.test.done(); | ||
28 | }); |
-
Please register or sign in to post a comment