Skip to content
Browse files

set ?go-get=1 page Content-Type to "text/plain"

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 1f59c0d301d82f2abd81a7775517edafcd5158c0
Showing with 1 addition and 1 deletion.
  1. +1 −1 code.go
@@ -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" {
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">
<meta name="go-source" content="%[1]s https://%[1]s[2]s[2]s#{file}-L{line}">`, d.RepoRoot, d.ImportPath)

0 comments on commit 1f59c0d

Please sign in to comment.
You can’t perform that action at this time.