func (t *TestAPI) Patch(target string, body io.Reader, headersQueryParams ...interface{}) *TestAPI {
	req, err := patch(target, body, headersQueryParams...)
	if err != nil {
		t.t.Helper()
		t.t.Fatal(err)
	}
	return t.Request(req)
}
Patch sends a HTTP PATCH to the tested API. Any Cmp* or NoBody methods
can now be called.

Note that Failed() status is reset just after this call.

See NewRequest for all possible formats accepted in headersQueryParams.
package tdhttp
import (
	"encoding/json"
	"encoding/xml"
	"fmt"
	"io"
	"net/http"
	"net/http/httptest"
	"net/url"
	"reflect"
	"runtime"
	"strings"
	"testing"
	"time"
	"github.com/maxatome/go-testdeep/helpers/tdhttp/internal"
	"github.com/maxatome/go-testdeep/helpers/tdutil"
	"github.com/maxatome/go-testdeep/internal/color"
	"github.com/maxatome/go-testdeep/internal/ctxerr"
	"github.com/maxatome/go-testdeep/internal/types"
	"github.com/maxatome/go-testdeep/td"
)
type TestAPI struct {
	t       *td.T
	handler http.Handler
	name    string
	sentAt        time.Time
	response      *httptest.ResponseRecorder
	statusFailed  bool
	headerFailed  bool
	cookiesFailed bool
	bodyFailed    bool
	autoDumpResponse bool
	responseDumped   bool
}
func NewTestAPI(tb testing.TB, handler http.Handler) *TestAPI {
	return &TestAPI{
		t:       td.NewT(tb),
		handler: handler,
	}
}
func (t *TestAPI) With(tb testing.TB) *TestAPI {
	return &TestAPI{
		t:                td.NewT(tb),
		handler:          t.handler,
		autoDumpResponse: t.autoDumpResponse,
	}
}
func (t *TestAPI) T() *td.T {
	return t.t
}
func (t *TestAPI) Run(name string, f func(t *TestAPI)) bool {
	return t.t.Run(name, func(tdt *td.T) {
		f(NewTestAPI(tdt, t.handler))
	})
}
func (t *TestAPI) AutoDumpResponse() *TestAPI {
	t.autoDumpResponse = true
	return t
}
func (t *TestAPI) Name(args ...interface{}) *TestAPI {
	t.name = tdutil.BuildTestName(args...)
	if t.name != "" {
		t.name += ": "
	}
	return t
}
func (t *TestAPI) Request(req *http.Request) *TestAPI {
	t.response = httptest.NewRecorder()
	t.statusFailed = false
	t.headerFailed = false
	t.cookiesFailed = false
	t.bodyFailed = false
	t.sentAt = time.Now().Truncate(0)
	t.responseDumped = false
	t.handler.ServeHTTP(t.response, req)
	return t
}
func (t *TestAPI) checkRequestSent() bool {
	t.t.Helper()
	return t.t.RootName("Request").
		Code(t.response != nil,
			func(sent bool) error {
				if sent {
					return nil
				}
				return &ctxerr.Error{
					Message: "%% not sent!",
					Summary: ctxerr.NewSummary("A request must be sent before testing status, header or body"),
				}
			},
			t.name+"request is sent")
}
func (t *TestAPI) Failed() bool {
	return t.statusFailed || t.headerFailed || t.cookiesFailed || t.bodyFailed
}
func (t *TestAPI) Get(target string, headersQueryParams ...interface{}) *TestAPI {
	req, err := get(target, headersQueryParams...)
	if err != nil {
		t.t.Helper()
		t.t.Fatal(err)
	}
	return t.Request(req)
}
func (t *TestAPI) Head(target string, headersQueryParams ...interface{}) *TestAPI {
	req, err := head(target, headersQueryParams...)
	if err != nil {
		t.t.Helper()
		t.t.Fatal(err)
	}
	return t.Request(req)
}
func (t *TestAPI) Post(target string, body io.Reader, headersQueryParams ...interface{}) *TestAPI {
	req, err := post(target, body, headersQueryParams...)
	if err != nil {
		t.t.Helper()
		t.t.Fatal(err)
	}
	return t.Request(req)
}
func (t *TestAPI) PostForm(target string, data url.Values, headersQueryParams ...interface{}) *TestAPI {
	req, err := postForm(target, data, headersQueryParams...)
	if err != nil {
		t.t.Helper()
		t.t.Fatal(err)
	}
	return t.Request(req)
}
func (t *TestAPI) PostMultipartFormData(target string, data *MultipartBody, headersQueryParams ...interface{}) *TestAPI {
	req, err := postMultipartFormData(target, data, headersQueryParams...)
	if err != nil {
		t.t.Helper()
		t.t.Fatal(err)
	}
	return t.Request(req)
}
func (t *TestAPI) Put(target string, body io.Reader, headersQueryParams ...interface{}) *TestAPI {
	req, err := put(target, body, headersQueryParams...)
	if err != nil {
		t.t.Helper()
		t.t.Fatal(err)
	}
	return t.Request(req)
}