()
| 596 | |
| 597 | |
| 598 | function 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 | |
| 629 | function TEST_httpBodyParam() { |
| 630 | let p = Buffer.from("POST / HTTP/1.1\r\n\r\n"); |
nothing calls this directly
no test coverage detected