Skip to content
This repository was archived by the owner on Jun 17, 2026. It is now read-only.

Add Content-Type header to promhttp - #57

Open
dsmeytis wants to merge 2 commits into
digitalocean:masterfrom
dsmeytis:promhttp-content-type
Open

Add Content-Type header to promhttp#57
dsmeytis wants to merge 2 commits into
digitalocean:masterfrom
dsmeytis:promhttp-content-type

Conversation

@dsmeytis

Copy link
Copy Markdown

Hello,
Monitoring service (i.e. DataDog) gives an error in attempt to gather metrics exposed by promhttp because it doesn't put any Content-Type header into HTTP response. This small change includes Content-Type text/plain to the responses in order to fix this problem.
Thanks for your attention.

@dsmeytis
dsmeytis requested a review from a team as a code owner April 23, 2021 09:00
@xmcqueen

xmcqueen commented May 6, 2021

Copy link
Copy Markdown

Looks good to me.

Comment thread promhttp/src/promhttp.c Outdated
#include "microhttpd.h"
#include "prom.h"

#define MIMETYPE_TEXT_PLAIN "text/plain"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

text/plain; version=0.0.4; charset=utf-8 is the correct value for this.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed.

@wangzw

wangzw commented Sep 15, 2025

Copy link
Copy Markdown

Is there any reason not merging this? Got the same error.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants