dmitri.shuralyov.com/website/gido

Apply minor fixups.

Remove workaround for https://groups.google.com/forum/#!topic/golang-nuts/9AVyMP9C8Ac
since it has been fixed upstream in Go 1.10.
dmitshur committed 6 years ago commit 4479f43e294e6d0fdca23d3a85cb471f2ee70f8c
Showing partial commit. Full Commit
Collapse all
service_test.go
@@ -39,12 +39,12 @@ func TestParsePrefixedTitle(t *testing.T) {
		},
	}
	for _, tc := range tests {
		gotPaths, gotTitle := gido.ParsePrefixedTitle(tc.in)
		if !reflect.DeepEqual(gotPaths, tc.wantPaths) {
			t.Errorf("got: %q, want: %q", gotPaths, tc.wantPaths)
			t.Errorf("got paths: %q, want: %q", gotPaths, tc.wantPaths)
		}
		if gotTitle != tc.wantTitle {
			t.Errorf("got: %q, want: %q", gotTitle, tc.wantTitle)
			t.Errorf("got title: %q, want: %q", gotTitle, tc.wantTitle)
		}
	}
}
util.go
@@ -37,13 +37,10 @@ func (h *errorHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
	if err, ok := httperror.IsMethod(err); ok {
		httperror.HandleMethod(w, err)
		return
	}
	if err, ok := httperror.IsRedirect(err); ok {
		if req.Method == http.MethodGet { // Workaround for https://groups.google.com/forum/#!topic/golang-nuts/9AVyMP9C8Ac.
			w.Header().Set("Content-Type", "text/html; charset=utf-8")
		}
		http.Redirect(w, req, err.URL, http.StatusSeeOther)
		return
	}
	if err, ok := httperror.IsBadRequest(err); ok {
		httperror.HandleBadRequest(w, err)