Skip to content

Commit

Permalink
set ?go-get=1 page Content-Type to "text/plain"
Browse files Browse the repository at this point in the history
There's no HTML on them anyway, so no point in using "text/html".
This way, it's easier to see (or show) their content in a browser,
no need to use view-source.
  • Loading branch information
dmitshur committed Nov 2, 2019
1 parent a8cced5 commit 1f59c0d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion code.go
Expand Up @@ -71,7 +71,7 @@ func (h *codeHandler) ServeCodeMaybe(w http.ResponseWriter, req *http.Request) (
// Handle ?go-get=1 requests, serve a go-import meta tag page.
if req.Method == http.MethodGet && req.URL.Query().Get("go-get") == "1" {
metrics.IncGoGetRequestsTotal(d.ImportPath)
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
fmt.Fprintf(w, `<meta name="go-import" content="%[1]s git https://%[1]s">
<meta name="go-import" content="%[1]s mod https://dmitri.shuralyov.com/api/module">
<meta name="go-source" content="%[1]s https://%[1]s https://gotools.org/%[2]s https://gotools.org/%[2]s#{file}-L{line}">`, d.RepoRoot, d.ImportPath)
Expand Down

0 comments on commit 1f59c0d

Please sign in to comment.