func (ts *testServer) DoRequest(req *Request) *Response {
	// First prepare it.
	transport := &http.Transport{}
	c := &http.Client{Transport: transport}
	url := ts.server.URL + req.Path
	var bodyReader io.Reader
	if req.Body != nil {
		bodyReader = ioutil.NopCloser(bytes.NewBuffer(req.Body))
	}
	httpReq, err := http.NewRequest(req.Method, url, bodyReader)
	ts.assert.Nil(err, "cannot prepare request")
	for key, value := range req.Header {
		httpReq.Header.Set(key, value)
	}
	for key, value := range req.Cookies {
		cookie := &http.Cookie{
			Name:  key,
			Value: value,
		}
		httpReq.AddCookie(cookie)
	}
	// Check if request shall be pre-processed before performed.
	if req.RequestProcessor != nil {
		httpReq = req.RequestProcessor(httpReq)
	}
	// Now do it.
	resp, err := c.Do(httpReq)
	ts.assert.Nil(err, "cannot perform test request")
	return ts.response(resp)
}
// DoRequest implements the TestServer interface.
DoRequest implements the TestServer interface.
// DoRequest implements the TestServer interface .
func (ts *testServer) DoRequest(req *Request) *Response {
	transport := &http.Transport{}
	c := &http.Client{Transport: transport}
	url := ts.server.URL + req.Path
	var bodyReader io.Reader
	if req.Body != nil {
		bodyReader = ioutil.NopCloser(bytes.NewBuffer(req.Body))
	}
	httpReq, err := http.NewRequest(req.Method, url, bodyReader)
	ts.assert.Nil(err, "cannot prepare request")
	for key, value := range req.Header {
		httpReq.Header.Set(key, value)
	}
	for key, value := range req.Cookies {
		cookie := &http.Cookie{
			Name:  key,
			Value: value,
		}
		httpReq.AddCookie(cookie)
	}
	if req.RequestProcessor != nil {
		httpReq = req.RequestProcessor(httpReq)
	}
	resp, err := c.Do(httpReq)
	ts.assert.Nil(err, "cannot perform test request")
	return ts.response(resp)
}
func ( ts * testServer ) DoRequest ( req * Request ) * Response { transport := & http . Transport { } c := & http . Client { Transport : transport } url := ts . server . URL + req . Path var bodyReader io . Reader if req . Body != nil { bodyReader = ioutil . NopCloser ( bytes . NewBuffer ( req . Body ) ) } httpReq , err := http . NewRequest ( req . Method , url , bodyReader ) ts . assert . Nil ( err , " " ) for key , value := range req . Header { httpReq . Header . Set ( key , value ) } for key , value := range req . Cookies { cookie := & http . Cookie { Name : key , Value : value , } httpReq . AddCookie ( cookie ) } if req . RequestProcessor != nil { httpReq = req . RequestProcessor ( httpReq ) } resp , err := c . Do ( httpReq ) ts . assert . Nil ( err , " " ) return ts . response ( resp ) }
DoRequest implements the TestServer interface.
DoRequest implements the TestServer interface .
// First prepare it. // Check if request shall be pre-processed before performed. // Now do it.