()
| 658 | } |
| 659 | |
| 660 | function TEST_httpHeader() { |
| 661 | const examplePayload = "GET / HTTP/1.1\r\nHost: localhost:3000\r\nUser-Agent: Node\r\nContent-Length:5\r\n\r\nhello"; |
| 662 | |
| 663 | let expected = {"Host": "localhost:3000", "User-Agent": "Node", "Content-Length": "5"} |
| 664 | |
| 665 | Object.keys(expected).forEach(function(name){ |
| 666 | let payload = Buffer.from(examplePayload); |
| 667 | let header = httpHeader(payload, name); |
| 668 | if (!header) { |
| 669 | fail(`Header not found. Was looking for: ${name}`) |
| 670 | } |
| 671 | if (header && header.value != expected[name]) { |
| 672 | fail(`${name}: '${expected[name]}' != '${header.value}'`) |
| 673 | } |
| 674 | }) |
| 675 | } |
| 676 | |
| 677 | |
| 678 | function TEST_setHttpHeader() { |
nothing calls this directly
no test coverage detected