Review and clean vanity
git-svn-id: file:///srv/svn/repo/toyohime/trunk@21 922d331f-388e-da47-97a9-ad700dc0b8b9
This commit is contained in:
parent
6ca3e72fb1
commit
05892d509d
@ -48,8 +48,8 @@ func NewServer(domain string, config map[Path]Package) *Server {
|
||||
|
||||
func (s Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Add("Content-Type", "text/html; charset=utf-8")
|
||||
if r.Method != "GET" {
|
||||
http.Error(w, "method not allowed", http.StatusMethodNotAllowed)
|
||||
if r.Method != http.MethodGet {
|
||||
http.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -28,13 +28,13 @@ func TestHTTPMethodsSupport(t *testing.T) {
|
||||
method string
|
||||
status int
|
||||
}{
|
||||
{"GET", 200},
|
||||
{"HEAD", 405},
|
||||
{"POST", 405},
|
||||
{"PUT", 405},
|
||||
{"DELETE", 405},
|
||||
{"TRACE", 405},
|
||||
{"OPTIONS", 405},
|
||||
{http.MethodGet, http.StatusOK},
|
||||
{http.MethodHead, http.StatusMethodNotAllowed},
|
||||
{http.MethodPost, http.StatusMethodNotAllowed},
|
||||
{http.MethodPut, http.StatusMethodNotAllowed},
|
||||
{http.MethodDelete, http.StatusMethodNotAllowed},
|
||||
{http.MethodTrace, http.StatusMethodNotAllowed},
|
||||
{http.MethodOptions, http.StatusMethodNotAllowed},
|
||||
}
|
||||
for _, test := range tests {
|
||||
req, err := http.NewRequest(test.method, "/gist?go-get=1", nil)
|
||||
@ -168,6 +168,5 @@ func TestBrowserGoDoc(t *testing.T) {
|
||||
if contentType != expected {
|
||||
t.Fatalf("Expecting content type '%v', but got '%v'", expected, contentType)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user