Browse Source

Fixed basic error handling for some requests

Eliezer Croitoru 3 years ago
parent
commit
6b233a1423
2 changed files with 3 additions and 1 deletions
  1. 3 0
      example/redirect.go
  2. 0 1
      server.go

+ 3 - 0
example/redirect.go

@@ -60,6 +60,9 @@ func toGolang(w icap.ResponseWriter, req *icap.Request) {
 			// Return the request unmodified.
 			w.WriteHeader(204, nil, false)
 		}
+	case "ERRDUMMY":
+		w.WriteHeader(400, nil, false)
+		fmt.Println("Malformed request")
 	default:
 		w.WriteHeader(405, nil, false)
 		fmt.Println("Invalid request method")

+ 0 - 1
server.go

@@ -112,7 +112,6 @@ func (c *conn) serve() {
 
 //		w = new(respWriter)
 //		w.conn =  c
-		log.Println(w)
 		w.req = new(Request)
 		w.req.Method = "ERRDUMMY"
 		w.req.RawURL = "/"