func IsConflict(err error) bool {
	return IsStatus(err, http.StatusConflict)
}
IsConflict returns true if err is a "status conflict" StatusError.
package httputil
import (
	"context"
	"crypto/tls"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"net/http"
	"net/url"
	"time"
	"github.com/cenkalti/backoff"
	"github.com/uber/makisu/lib/log"
)
var retryableCodes = map[int]struct{}{
	http.StatusTooManyRequests:    {},
	http.StatusBadGateway:         {},
	http.StatusServiceUnavailable: {},
	http.StatusGatewayTimeout:     {},
}
type StatusError struct {
	Method       string
	URL          string
	Status       int
	Header       http.Header
	ResponseDump string
}
func NewStatusError(resp *http.Response) StatusError {
	defer resp.Body.Close()
	respBytes, err := ioutil.ReadAll(resp.Body)
	respDump := string(respBytes)
	if err != nil {
		respDump = fmt.Sprintf("failed to dump response: %s", err)
	}
	return StatusError{
		Method:       resp.Request.Method,
		URL:          resp.Request.URL.String(),
		Status:       resp.StatusCode,
		Header:       resp.Header,
		ResponseDump: respDump,
	}
}
func (e StatusError) Error() string {
	if e.ResponseDump == "" {
		return fmt.Sprintf("%s %s %d", e.Method, e.URL, e.Status)
	}
	return fmt.Sprintf("%s %s %d: %s", e.Method, e.URL, e.Status, e.ResponseDump)
}
func IsStatus(err error, status int) bool {
	var e StatusError
	if errors.As(err, &e) {
		return e.Status == status
	}
	return false
}
func IsCreated(err error) bool {
	return IsStatus(err, http.StatusCreated)
}
func IsNotFound(err error) bool {
	return IsStatus(err, http.StatusNotFound)
}