From 961950b35d4116478abca8e389634d56923d53c4 Mon Sep 17 00:00:00 2001 From: debugtalk Date: Thu, 23 Sep 2021 21:42:42 +0800 Subject: [PATCH] examples: add post form data and put request --- examples/postman_echo/hardcode_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/examples/postman_echo/hardcode_test.go b/examples/postman_echo/hardcode_test.go index 6e8340b8..e9dbd4aa 100644 --- a/examples/postman_echo/hardcode_test.go +++ b/examples/postman_echo/hardcode_test.go @@ -26,6 +26,18 @@ func TestCaseHardcode(t *testing.T) { WithData("This is expected to be sent back as part of response body."). Validate(). AssertEqual("status_code", 200, "check status code"), + httpboomer.Step("post form data"). + POST("/post"). + WithHeaders(map[string]string{"User-Agent": "HttpBoomer", "Content-Type": "application/x-www-form-urlencoded"}). + WithParams(map[string]interface{}{"foo1": "bar1", "foo2": "bar2"}). + Validate(). + AssertEqual("status_code", 200, "check status code"), + httpboomer.Step("put request"). + PUT("/put"). + WithHeaders(map[string]string{"User-Agent": "HttpBoomer", "Content-Type": "text/plain"}). + WithData("This is expected to be sent back as part of response body."). + Validate(). + AssertEqual("status_code", 200, "check status code"), }, }