Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

Commit 032ae96

Browse files
Changing code array back to numbers. Using parseInt on string value instead.
1 parent e63f0d5 commit 032ae96

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/scripts/httpcat.coffee

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@
2020
# Author:
2121
# @commadelimited
2222

23-
codes = ['100', '101', '200', '201', '202', '204', '206', '207', '300', '301', '303', '304',
24-
'305', '307', '400', '401', '402', '403', '404', '405', '406', '408', '409', '410',
25-
'411', '413', '414', '416', '417', '418', '422', '423', '424', '425', '426', '429',
26-
'431', '444', '450', '500', '502', '503', '506', '507', '508', '509', '599']
23+
codes = [100, 101, 200, 201, 202, 204, 206, 207, 300, 301, 303, 304,
24+
305, 307, 400, 401, 402, 403, 404, 405, 406, 408, 409, 410,
25+
411, 413, 414, 416, 417, 418, 422, 423, 424, 425, 426, 429,
26+
431, 444, 450, 500, 502, 503, 506, 507, 508, 509, 599]
2727

2828
module.exports = (robot) ->
2929
robot.respond /httpcat (.+)/i, (msg) ->
30-
if (codes.indexOf( msg.match[1] ) > -1)
30+
status = parseInt(msg.match[1], 10)
31+
if (codes.indexOf( status ) > -1)
3132
msg.send 'http://httpcats.herokuapp.com/' + status + '.jpg'
3233
else
3334
msg.send 'I only recognize the following status codes: ' + codes

0 commit comments

Comments
 (0)