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

Function TEST_httpPathParam

middleware/middleware.js:598–627  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

596
597
598function TEST_httpPathParam() {
599 let p = Buffer.from("GET / HTTP/1.1\r\n\r\n");
600
601 if (httpPathParam(p, "test")) {
602 return fail("Should not found param")
603 }
604
605 p = setHttpPathParam(p, "test", "123");
606 if (httpPath(p) != "/?test=123") {
607 return fail("Should set first param: " + httpPath(p));
608 }
609
610 if (httpPathParam(p, "test") != "123") {
611 return fail("Should get first param: " + httpPathParam(p, "test"));
612 }
613
614 p = setHttpPathParam(p, "qwer", "ty");
615 if (httpPath(p) != "/?test=123&qwer=ty") {
616 return fail("Should set second param: " + httpPath(p));
617 }
618
619 p = setHttpPathParam(p, "test", "4321");
620 if (httpPath(p) != "/?test=4321&qwer=ty") {
621 return fail("Should update first param: " + httpPath(p));
622 }
623
624 if (httpPathParam(p, "test") != "4321") {
625 return fail("Should update first param: " + httpPath(p));
626 }
627}
628
629function TEST_httpBodyParam() {
630 let p = Buffer.from("POST / HTTP/1.1\r\n\r\n");

Callers

nothing calls this directly

Calls 4

httpPathParamFunction · 0.85
failFunction · 0.85
setHttpPathParamFunction · 0.85
httpPathFunction · 0.85

Tested by

no test coverage detected