func (ts *testServer) DoUpload(path, fieldname, filename, data string) *Response {
	// Prepare request.
	transport := &http.Transport{}
	c := &http.Client{Transport: transport}
	url := ts.server.URL + path
	buffer := &bytes.Buffer{}
	writer := multipart.NewWriter(buffer)
	part, err := writer.CreateFormFile(fieldname, filename)
	ts.assert.Nil(err, "cannot create form file")
	_, err = io.WriteString(part, data)
	ts.assert.Nil(err, "cannot write data")
	contentType := writer.FormDataContentType()
	err = writer.Close()
	ts.assert.Nil(err, "cannot close multipart writer")
	// And now do it.
	resp, err := c.Post(url, contentType, buffer)
	ts.assert.Nil(err, "cannot perform test upload")
	return ts.response(resp)
}
// DoUpload implements the TestServer interface.
DoUpload implements the TestServer interface.
// DoUpload implements the TestServer interface .
func (ts *testServer) DoUpload(path, fieldname, filename, data string) *Response {
	transport := &http.Transport{}
	c := &http.Client{Transport: transport}
	url := ts.server.URL + path
	buffer := &bytes.Buffer{}
	writer := multipart.NewWriter(buffer)
	part, err := writer.CreateFormFile(fieldname, filename)
	ts.assert.Nil(err, "cannot create form file")
	_, err = io.WriteString(part, data)
	ts.assert.Nil(err, "cannot write data")
	contentType := writer.FormDataContentType()
	err = writer.Close()
	ts.assert.Nil(err, "cannot close multipart writer")
	resp, err := c.Post(url, contentType, buffer)
	ts.assert.Nil(err, "cannot perform test upload")
	return ts.response(resp)
}
func ( ts * testServer ) DoUpload ( path , fieldname , filename , data string ) * Response { transport := & http . Transport { } c := & http . Client { Transport : transport } url := ts . server . URL + path buffer := & bytes . Buffer { } writer := multipart . NewWriter ( buffer ) part , err := writer . CreateFormFile ( fieldname , filename ) ts . assert . Nil ( err , " " ) _ , err = io . WriteString ( part , data ) ts . assert . Nil ( err , " " ) contentType := writer . FormDataContentType ( ) err = writer . Close ( ) ts . assert . Nil ( err , " " ) resp , err := c . Post ( url , contentType , buffer ) ts . assert . Nil ( err , " " ) return ts . response ( resp ) }
DoUpload implements the TestServer interface.
DoUpload implements the TestServer interface .
// Prepare request. // And now do it.