-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure the services status page renders as HTML #1265
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,10 +19,10 @@ const tpl = ` | |
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Services Status</title> | ||
<title>Services' status</title> | ||
</head> | ||
<body> | ||
<h1>Services Status</h1> | ||
<h1>Services' status</h1> | ||
<p>Current time: {{ .Now }}</p> | ||
<table border="1"> | ||
<thead> | ||
|
@@ -55,8 +55,7 @@ func init() { | |
} | ||
|
||
func (t *Mimir) servicesHandler(w http.ResponseWriter, r *http.Request) { | ||
w.WriteHeader(200) | ||
w.Header().Set("Content-Type", "text/plain") | ||
w.Header().Set("Content-Type", "text/html; utf=8") | ||
Comment on lines
-59
to
+58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just checked the response for the
So there's some kind of magic happening somewhere, I can recall that Golang detected the content type based on what the output looks like. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, see doc for
I don't think we should rely on it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's happening here: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think it's not critical and we can expect it to work properly when we're sending HTML, but if not, sure, we can always specify it explicitly. Anyway, my main comment was that we shouldn't set the content type here prematurely. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Agree. |
||
|
||
svcs := make([]renderService, 0) | ||
for mod, s := range t.ServiceMap { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be rebased.