Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,5 +186,9 @@ func (h healthHandler) responseContentType(outputName string) string {
if outputName == "json" {
return "application/json"
}
if outputName == "prometheus" {
return "text/plain; version=0.0.4"
}

return fmt.Sprintf("%s%s", mediaTypePrefix, outputName)
}
9 changes: 9 additions & 0 deletions serve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@ func TestServeNegotiatingContent(t *testing.T) {
expectedHTTPStatus: http.StatusOK,
expectedContentType: "application/json",
},
"accept prometheus": {
acceptHeader: []string{
"text/plain; version=0.0.4",
},
outputFormat: "prometheus",
specFile: filepath.Join("testdata", "passing.goss.yaml"),
expectedHTTPStatus: http.StatusOK,
expectedContentType: "text/plain; version=0.0.4",
},
"accept header contains vendor-specific output format different from process-level": {
acceptHeader: []string{
"application/vnd.goss-rspecish",
Expand Down
Loading