func (test *HTTPTest) CreateHTTPRequest(request Request) *http.Request {
	tassert := assert.New(test.T)
	var body io.Reader
	data, err := test.Encoder(request.Body)
	tassert.NoError(err)
	body = bytes.NewBuffer(data)
	req, err := http.NewRequest(request.Method, request.URL, body)
	tassert.NoError(err, "Error while creating Request")
	if request.Header != nil {
		req.Header = request.Header
	}
	return req
}
CreateHTTPRequest creates http Request with basic data
package testutils
import (
	"bytes"
	"encoding/json"
	"io"
	"net/http"
	"net/http/httptest"
	"testing"
	"github.com/pkg/errors"
	"github.com/stretchr/testify/assert"
)
const (
	ContentTypeJSON contentType = "application/json"
	ContentTypeHTML contentType = "text/html"
	ContentTypePlain contentType = "text/plain; charset=utf-8"
)
type contentType string
type Request struct {
	Method string
	URL    string
	Header http.Header
	Body   interface{}
}
type ExpectedResponse struct {
	StatusCode   int
	ResponseType contentType
	Body         interface{}
}
type HTTPTest struct {
	*testing.T
	Encoder func(interface{}) ([]byte, error)
}
func EncodeJSON(data interface{}) ([]byte, error) {
	if data == nil {
		return []byte{}, nil
	}
	b, err := json.Marshal(data)
	if err != nil {
		return []byte{}, errors.Wrap(err, "Error while encoding json")
	}
	return b, nil
}
func EncodeString(data interface{}) ([]byte, error) {
	if data == nil {
		return []byte{}, nil
	}
	if s, ok := data.(string); ok {
		return []byte(s), nil
	}
	return []byte{}, errors.New("error while decoding string")
}