feat: add http request with github.com/imroc/req

This commit is contained in:
debugtalk
2021-09-22 14:23:32 +08:00
parent f19454d050
commit 5281ad7c25
5 changed files with 34 additions and 7 deletions

View File

@@ -6,14 +6,14 @@ import (
var (
tStepGET = RunRequest("get with params").
GET("/get").
GET("https://postman-echo.com/get").
WithParams(Params{"foo1": "bar1", "foo2": "bar2"}).
WithHeaders(Headers{"User-Agent": "HttpBoomer"}).
WithCookies(Cookies{"user": "debugtalk"}).
Validate().
AssertEqual("status_code", 200, "check status code")
tStepPOSTData = RunRequest("post form data").
POST("/post").
POST("https://postman-echo.com/post").
WithParams(Params{"foo1": "bar1", "foo2": "bar2"}).
WithHeaders(Headers{"User-Agent": "HttpBoomer", "Content-Type": "application/x-www-form-urlencoded"}).
WithData("a=1&b=2").