func ResponseFormat(h http.Header) (Format, error) {
	ct := h.Get(hdrContentType)
	mediatype, params, err := mime.ParseMediaType(ct)
	if err != nil {
		return "", fmt.Errorf("invalid Content-Type header %q: %s", ct, err)
	}
	const (
		textType = "text/plain"
		jsonType = "application/json"
	)
	switch mediatype {
	case ProtoType:
		if p := params["proto"]; p != ProtoProtocol {
			return "", fmt.Errorf("unrecognized protocol message %s", p)
		}
		if e := params["encoding"]; e != "delimited" {
			return "", fmt.Errorf("unsupported encoding %s", e)
		}
		return FmtProtoDelim, nil
	case textType:
		if v, ok := params["version"]; ok && v != TextVersion {
			return "", fmt.Errorf("unrecognized protocol version %s", v)
		}
		return FmtText, nil
	case jsonType:
		var prometheusAPIVersion string
		if params["schema"] == "prometheus/telemetry" && params["version"] != "" {
			prometheusAPIVersion = params["version"]
		} else {
			prometheusAPIVersion = h.Get("X-Prometheus-API-Version")
		}
		switch prometheusAPIVersion {
		case "0.0.2":
			return FmtJSON2, nil
		default:
			return "", fmt.Errorf("unrecognized API version %s", prometheusAPIVersion)
		}
	}
	return "", fmt.Errorf("unsupported media type %q, expected %q or %q", mediatype, ProtoType, textType)
}
ResponseFormat extracts the correct format from a HTTP response header.
package expfmt
import (
	"fmt"
	"io"
	"math"
	"mime"
	"net/http"
	dto "github.com/prometheus/client_model/go"
	"github.com/matttproud/golang_protobuf_extensions/pbutil"
	"github.com/prometheus/common/model"
)
type Decoder interface {
	Decode(*dto.MetricFamily) error
}
type DecodeOptions struct {
	Timestamp model.Time
}