Adding predefined steps in testhttp package
Here's the full list:
_ = addStep.AddStep(`^I make a (GET|POST|PUT|DELETE|OPTIONS) request to "([^"]*)"$`, testHTTP.makeRequest)
_ = addStep.AddStep(`^the response code equals (\d+)$`, testHTTP.statusCodeEquals)
_ = addStep.AddStep(`^the response contains a valid JSON$`, testHTTP.validJSON)
_ = addStep.AddStep(`^the response is "(.*)"$`, testHTTP.theResponseIs)
_ = addStep.AddStep(`^the response header "(.*)" equals "(.*)"$`, testHTTP.responseHeaderEquals)
_ = addStep.AddStep(`^I have a (GET|POST|PUT|DELETE|OPTIONS) request "(.*)"$`, testHTTP.iHaveARequest)
_ = addStep.AddStep(`^I set request header "(.*)" to "(.*)"$`, testHTTP.iSetRequestSetTo)
_ = addStep.AddStep(`^I set request body to "([^"]*)"$`, testHTTP.iSetRequestBodyTo)
_ = addStep.AddStep(`^the request has body "(.*)"$`, testHTTP.theRequestHasBody)
_ = addStep.AddStep(`^I make the request$`, testHTTP.iMakeRequest)
What's more, I made RequestKey
and ResponseKey
so defining your custom steps should be easier.