bump(github.com/docker/libcompose) v0.3.0

This commit is contained in:
Tomas Kral
2016-08-22 10:51:22 +02:00
parent 223b4f37fa
commit e341adce0e
57 changed files with 944 additions and 12907 deletions
+23 -2
View File
@@ -46,7 +46,10 @@ func ResponseFormat(h http.Header) Format {
return FmtUnknown
}
const textType = "text/plain"
const (
textType = "text/plain"
jsonType = "application/json"
)
switch mediatype {
case ProtoType:
@@ -63,6 +66,22 @@ func ResponseFormat(h http.Header) Format {
return FmtUnknown
}
return FmtText
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
default:
return FmtUnknown
}
}
return FmtUnknown
@@ -74,6 +93,8 @@ func NewDecoder(r io.Reader, format Format) Decoder {
switch format {
case FmtProtoDelim:
return &protoDecoder{r: r}
case fmtJSON2:
return newJSON2Decoder(r)
}
return &textDecoder{r: r}
}
@@ -111,7 +132,7 @@ func (d *protoDecoder) Decode(v *dto.MetricFamily) error {
return nil
}
// textDecoder implements the Decoder interface for the text protocol.
// textDecoder implements the Decoder interface for the text protcol.
type textDecoder struct {
r io.Reader
p TextParser