1 var test = require('tape')
2 , parse = require('./parse-headers')
6 , 'Date: Sun, 17 Aug 2014 16:24:52 GMT'
7 , 'Content-Type: text/html; charset=utf-8'
8 , 'Transfer-Encoding: chunked'
13 , 'Date: Sun, 17 Aug 2014 16:24:52 GMT'
14 , 'Content-Type: text/html; charset=utf-8'
15 , 'Transfer-Encoding: chunked'
21 test('sanity check', function (t) {
23 t.deepEqual(parse(), {})
24 t.deepEqual(parse(''), {})
28 test('simple', function (t) {
30 parse(headers1.join('\r\n'))
32 date: 'Sun, 17 Aug 2014 16:24:52 GMT'
33 , 'content-type': 'text/html; charset=utf-8'
34 , 'transfer-encoding': 'chunked'
38 parse(headers1.join('\n'))
40 date: 'Sun, 17 Aug 2014 16:24:52 GMT'
41 , 'content-type': 'text/html; charset=utf-8'
42 , 'transfer-encoding': 'chunked'
49 test('duplicate keys', function (t) {
51 parse(headers2.join('\r\n'))
53 date: 'Sun, 17 Aug 2014 16:24:52 GMT'
54 , 'content-type': 'text/html; charset=utf-8'
55 , 'transfer-encoding': 'chunked'
56 , 'set-cookie': [ 'Foo', 'bar', 'bong' ]
60 parse(headers2.join('\n'))
62 date: 'Sun, 17 Aug 2014 16:24:52 GMT'
63 , 'content-type': 'text/html; charset=utf-8'
64 , 'transfer-encoding': 'chunked'
65 , 'set-cookie': [ 'Foo', 'bar', 'bong' ]