Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultHTTPStubs = []HTTPStub{ { "GET", "/get", map[string]string{"param1": "a", "param2": "日本語"}, nil, nil, 201, nil, nil, HTTPStubOptions{}, }, { "POST", "/post", nil, map[string][]string{"Test-Req-Header": {"test1", "test2"}, "Test-Req-Header2": {"foo; bar"}}, &shortHTTPBody1a, 200, map[string][]string{"Test-Res-Header": {"test1", "test2"}, "Test-Res-Header2": {"foo; bar"}}, &shortHTTPBody1b, HTTPStubOptions{}, }, { "POST", "/post/large", nil, nil, &largeHTTPBody1a, 200, nil, &largeHTTPBody1b, HTTPStubOptions{ChunkResponseBodyPer: 1024}, }, }
View Source
var DefaultHTTPTestCases = []HTTPTestCase{ { "GET", "/get?param1=a¶m2=日本語", nil, nil, 201, nil, nil, HTTPTestCaseOptions{}, }, { "POST", "/post", map[string][]string{"Test-Req-Header": {"test1", "test2"}, "Test-Req-Header2": {"foo; bar"}}, &shortHTTPBody1a, 200, map[string][]string{"Test-Res-Header": {"test1", "test2"}, "Test-Res-Header2": {"foo; bar"}}, &shortHTTPBody1b, HTTPTestCaseOptions{}, }, { "POST", "/post/large", nil, &largeHTTPBody1a, 200, nil, &largeHTTPBody1b, HTTPTestCaseOptions{}, }, }
Functions ¶
func NewHTTPStubServer ¶
func RandomBytes ¶
Types ¶
type HTTPStub ¶
type HTTPStubOptions ¶
type HTTPStubOptions struct { // If not zero, chunk response body per this bytes ChunkResponseBodyPer int }
HTTPStubOptions is an options that usually not need to set
type HTTPTestCase ¶
type HTTPTestCase struct { Method string Path string RequestHeaders map[string][]string RequestBody *[]byte ExpectedStatus int ExpectedHeaders map[string][]string ExpectedBody *[]byte Options HTTPTestCaseOptions }
func (*HTTPTestCase) AssertResponse ¶
func (c *HTTPTestCase) AssertResponse(t *testing.T, res *http.Response)
func (*HTTPTestCase) String ¶
func (c *HTTPTestCase) String() string
type HTTPTestCaseOptions ¶
type HTTPTestCaseOptions struct{}
HTTPTestCaseOptions is an options that usually not need to set
Click to show internal directories.
Click to hide internal directories.