func newDecodeRequestError(req *http.Request, bodyData []byte, err error) *DecodeRequestError {
	if bodyData == nil {
		bodyData = readBodyForError(req.Body)
	}
	req1 := *req
	req1.Body = ioutil.NopCloser(bytes.NewReader(bodyData))
	return &DecodeRequestError{
		Request:     &req1,
		DecodeError: errgo.Mask(err, errgo.Any),
	}
}
newDecodeRequestError returns a new DecodeRequestError that
uses the given error for its message. The Request field
holds a copy of req. If bodyData is non-nil, it
will be used as the data in the Request.Body field;
otherwise body data will be read from req.Body.
package httprequest
import (
	"bytes"
	"fmt"
	"io"
	"io/ioutil"
	"mime"
	"net/http"
	"unicode"
	"golang.org/x/net/html"
	"golang.org/x/net/html/atom"
	"gopkg.in/errgo.v1"
)
func isDecodeResponseError(err error) bool {
	_, ok := err.(*DecodeResponseError)
	return ok
}
type DecodeResponseError struct {
	Response *http.Response
	DecodeError error
}
func (e *DecodeResponseError) Error() string {
	return e.DecodeError.Error()
}
func newDecodeResponseError(resp *http.Response, bodyData []byte, err error) *DecodeResponseError {
	if bodyData == nil {
		bodyData = readBodyForError(resp.Body)
	}
	resp1 := *resp
	resp1.Body = ioutil.NopCloser(bytes.NewReader(bodyData))
	return &DecodeResponseError{
		Response:    &resp1,
		DecodeError: errgo.Mask(err, errgo.Any),
	}
}