@@ -49,14 +49,14 @@ func (wh Webhook) ServeHTTP(w http.ResponseWriter, r *http.Request) {
49
49
if r .Body != nil {
50
50
if body , err = ioutil .ReadAll (r .Body ); err != nil {
51
51
log .Error (err , "unable to read the body from the incoming request" )
52
- reviewResponse = ErrorResponse (http .StatusBadRequest , err )
52
+ reviewResponse = Errored (http .StatusBadRequest , err )
53
53
wh .writeResponse (w , reviewResponse )
54
54
return
55
55
}
56
56
} else {
57
57
err = errors .New ("request body is empty" )
58
58
log .Error (err , "bad request" )
59
- reviewResponse = ErrorResponse (http .StatusBadRequest , err )
59
+ reviewResponse = Errored (http .StatusBadRequest , err )
60
60
wh .writeResponse (w , reviewResponse )
61
61
return
62
62
}
@@ -66,7 +66,7 @@ func (wh Webhook) ServeHTTP(w http.ResponseWriter, r *http.Request) {
66
66
if contentType != "application/json" {
67
67
err = fmt .Errorf ("contentType=%s, expected application/json" , contentType )
68
68
log .Error (err , "unable to process a request with an unknown content type" , "content type" , contentType )
69
- reviewResponse = ErrorResponse (http .StatusBadRequest , err )
69
+ reviewResponse = Errored (http .StatusBadRequest , err )
70
70
wh .writeResponse (w , reviewResponse )
71
71
return
72
72
}
@@ -78,7 +78,7 @@ func (wh Webhook) ServeHTTP(w http.ResponseWriter, r *http.Request) {
78
78
}
79
79
if _ , _ , err := admissionCodecs .UniversalDeserializer ().Decode (body , nil , & ar ); err != nil {
80
80
log .Error (err , "unable to decode the request" )
81
- reviewResponse = ErrorResponse (http .StatusBadRequest , err )
81
+ reviewResponse = Errored (http .StatusBadRequest , err )
82
82
wh .writeResponse (w , reviewResponse )
83
83
return
84
84
}
@@ -96,6 +96,6 @@ func (wh *Webhook) writeResponse(w io.Writer, response Response) {
96
96
err := encoder .Encode (responseAdmissionReview )
97
97
if err != nil {
98
98
log .Error (err , "unable to encode the response" )
99
- wh .writeResponse (w , ErrorResponse (http .StatusInternalServerError , err ))
99
+ wh .writeResponse (w , Errored (http .StatusInternalServerError , err ))
100
100
}
101
101
}
0 commit comments