diff --git a/server.go.tmpl b/server.go.tmpl index 17837f1..67dc7f3 100644 --- a/server.go.tmpl +++ b/server.go.tmpl @@ -49,14 +49,14 @@ func (s *{{$serviceName}}) ServeHTTP(w http.ResponseWriter, r *http.Request) { handler = s.serve{{$method.Name | firstLetterToUpper}}JSON{{if $method.StreamOutput}}Stream{{end}} {{- end}} default: - err := ErrWebrpcBadRoute.WithCause(fmt.Errorf("no handler for path %q", r.URL.Path)) + err := ErrWebrpcBadRoute.WithCause(fmt.Errorf("no WebRPC method defined for path %v", r.URL.Path)) s.sendErrorJSON(w, r, err) return } if r.Method != "POST" { w.Header().Add("Allow", "POST") // RFC 9110. - err := ErrWebrpcBadMethod.WithCause(fmt.Errorf("unsupported method %q (only POST is allowed)", r.Method)) + err := ErrWebrpcBadMethod.WithCause(fmt.Errorf("unsupported method %v (only POST is allowed)", r.Method)) s.sendErrorJSON(w, r, err) return } @@ -71,7 +71,7 @@ func (s *{{$serviceName}}) ServeHTTP(w http.ResponseWriter, r *http.Request) { case "application/json": handler(ctx, w, r) default: - err := ErrWebrpcBadRequest.WithCause(fmt.Errorf("unexpected Content-Type: %q", r.Header.Get("Content-Type"))) + err := ErrWebrpcBadRequest.WithCause(fmt.Errorf("unsupported Content-Type %q (only application/json is allowed)", r.Header.Get("Content-Type"))) s.sendErrorJSON(w, r, err) } }