Skip to content

Commit

Permalink
fix: Handle the empty accepts case.
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrozev committed Oct 15, 2024
1 parent 82d0d5b commit aff0bae
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ open class MetricsContainer @JvmOverloads constructor(
/** List of accepted media types in order of preference */
accepts: List<String>
): Pair<String, String> {
if (accepts.isEmpty()) {
return getPrometheusMetrics(
TextFormat.CONTENT_TYPE_OPENMETRICS_100
) to TextFormat.CONTENT_TYPE_OPENMETRICS_100
}
accepts.forEach {
when (it) {
"application/openmetrics-text" -> return getPrometheusMetrics(
Expand Down

0 comments on commit aff0bae

Please sign in to comment.