func httpGet(t *testing.T, url string) ([]byte, error) {
	t.Helper()
	client := &http.Client{}
	httpReq, err := http.NewRequest(http.MethodGet, url, nil)
	require.NoError(t, err)
	resp, err := invokeWithRetry(
		func() (response *http.Response, e error) {
			return client.Do(httpReq)
		},
	)
	require.NoError(t, err)
	return handleHTTPResp(resp)
}
httpGet send a regular GET request to the sidetree-node and expects 'side tree document' argument as a response.
package httpserver
import (
	"bytes"
	"context"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/http/httptest"
	"testing"
	"time"
	"github.com/stretchr/testify/require"
	"github.com/trustbloc/sidetree-core-go/pkg/restapi/common"
)
const (
	url       = "localhost:8080"
	clientURL = "http://" + url
	samplePath = "/sample"
)
func TestServer_Start(t *testing.T) {
	s := New(url,
		"",
		"",
		&mockUpdateHandler{},
		&mockResolveHandler{},
	)
	require.NoError(t, s.Start())
	require.Error(t, s.Start())
	time.Sleep(time.Second)
	t.Run("success - sample operation ", func(t *testing.T) {
		resp, err := httpPut(t, clientURL+samplePath, []byte(""))
		require.NoError(t, err)
		require.NotNil(t, resp)
	})
	t.Run("success - sample resolution", func(t *testing.T) {
		resp, err := httpGet(t, clientURL+samplePath+"/id")
		require.NoError(t, err)
		require.NotNil(t, resp)
	})
	t.Run("success - health check", func(t *testing.T) {
		b := &httptest.ResponseRecorder{}
		healthCheckHandler(b, nil)
		require.Equal(t, http.StatusOK, b.Code)
	})
	t.Run("Stop", func(t *testing.T) {
		require.NoError(t, s.Stop(context.Background()))
		require.Error(t, s.Stop(context.Background()))
	})
}
func httpPut(t *testing.T, url string, req []byte) ([]byte, error) {
	t.Helper()
	client := &http.Client{}
	httpReq, err := http.NewRequest("POST", url, bytes.NewReader(req))
	require.NoError(t, err)
	httpReq.Header.Set("Content-Type", "application/json")
	resp, err := invokeWithRetry(
		func() (response *http.Response, e error) {
			return client.Do(httpReq)
		},
	)
	require.NoError(t, err)
	return handleHTTPResp(resp)
}