MCPcopy
hub / github.com/probelabs/goreplay / TEST_httpHeader

Function TEST_httpHeader

middleware/middleware.js:660–675  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

658}
659
660function 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
678function TEST_setHttpHeader() {

Callers

nothing calls this directly

Calls 2

failFunction · 0.85
httpHeaderFunction · 0.70

Tested by

no test coverage detected