]> git.ipfire.org Git - thirdparty/FORT-validator.git/commit
Prometheus: Allow plaintext Content-Type issue50
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Fri, 8 Aug 2025 17:15:32 +0000 (11:15 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Fri, 8 Aug 2025 17:15:32 +0000 (11:15 -0600)
commit4e7121ea93f360e6d07c55d05d2a817bbfeea3ad
treec61aef26f2ff48401909e3095c5ff4f46379d2a3
parente0f64d4dcb8c9cf5b977903d6af1413fb7a9c08f
Prometheus: Allow plaintext Content-Type

In general, the openmetrics Content-Type is preferred. The code makes
an exception out of browsers, however.

The full logic is

- If the request has no Accept header, Content-Type will be openmetrics
  1.0.0.

- If the Accept header expects neither openmetrics nor plaintext,
  Content-Type will be plaintext 0.0.4.

This is because the client is usually a browser (which seem to typically
lack Openmetrics handlers) or a generic HTTP client like curl (which
don't really care about Content-Type).

- Otherwise Fort will decide between openmetrics 1.0.0 or plaintext
  0.0.4, depending on q-values. (Requested version will be ignored,
  because only one is supported for each.) If their q is the same,
  openmetrics will be preferred.

For #50.
src/prometheus.c