зеркало из https://github.com/golang/pkgsite.git
Revert "internal/frontend: add a handler to serve specific errors"
This reverts commit 30f40336360fd7860b59a6fe7526465b522ace38. Reason for revert: Testing is done, so this handler is no longer needed. Change-Id: I13d18509bc50571ac740215fd37d76cb250f7379 Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/597566 CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
This commit is contained in:
Родитель
b4b1d28c10
Коммит
a36598d63f
|
@ -12,7 +12,6 @@ import (
|
|||
"io"
|
||||
"net/http"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
@ -150,7 +149,6 @@ func (s *Server) Install(handle func(string, http.Handler), redisClient *redis.C
|
|||
handle("/license-policy", s.licensePolicyHandler())
|
||||
handle("/", detailHandler)
|
||||
handle("/latest-version/", latestVersionHandler)
|
||||
handle("/serve-an-error", http.HandlerFunc(serveAnError))
|
||||
handle("/robots.txt", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
http.ServeContent(w, r, "", time.Time{}, strings.NewReader(`User-agent: *
|
||||
|
@ -174,15 +172,6 @@ const (
|
|||
longTTL = 24 * time.Hour
|
||||
)
|
||||
|
||||
func serveAnError(w http.ResponseWriter, r *http.Request) {
|
||||
codeString := r.FormValue("code")
|
||||
code, err := strconv.Atoi(codeString)
|
||||
if err != nil {
|
||||
code = http.StatusOK
|
||||
}
|
||||
http.Error(w, http.StatusText(code), code)
|
||||
}
|
||||
|
||||
// packageTTL assigns the cache TTL for package detail requests.
|
||||
func packageTTL(r *http.Request) time.Duration {
|
||||
return detailsTTL(r.URL.Path, r.FormValue("tab"))
|
||||
|
|
Загрузка…
Ссылка в новой задаче