mirror of
https://github.com/gomods/athens
synced 2026-02-03 12:10:32 +00:00
Set correct Content-Type headers on each endpoint rather than on the router. The router would, at times, send two Content-Type headers and other times just send the wrong one.
16 lines
348 B
Go
16 lines
348 B
Go
package actions
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gomods/athens/pkg/config"
|
|
)
|
|
|
|
// robotsHandler implements GET baseURL/robots.txt.
|
|
func robotsHandler(c *config.Config) http.HandlerFunc {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
|
http.ServeFile(w, r, c.RobotsFile)
|
|
}
|
|
}
|