Skip to content

Commit

Permalink
fixed lint issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rg2011 committed Aug 8, 2024
1 parent 6ddfd9a commit 373c87f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/services/stats/statsRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,18 @@ function openmetricsHandler(req, res) {
res.status(406).send('Unsupported charset');
return;
}
let selectedVersion = supportedVersions[0];
switch (req.accepts(['text/plain', 'application/openmetrics-text'])) {
case 'application/openmetrics-text':
let version = supportedVersions[0];
if (requestedVersions.length > 0) {
version = matchPreferredValue(requestedVersions, supportedVersions);
if (!version) {
selectedVersion = matchPreferredValue(requestedVersions, supportedVersions);
if (!selectedVersion) {
logger.error(statsContext, 'Unsupported openmetrics version: %s', requestedVersions);
res.status(406).send('Unsupported openmetrics version');
return;
}
}
contentType = `application/openmetrics-text; version=${version}; charset=utf-8`;
contentType = `application/openmetrics-text; version=${selectedVersion}; charset=utf-8`;
break;
case 'text/plain':
// Text/plain only supports version 0.0.4
Expand Down

0 comments on commit 373c87f

Please sign in to comment.