Return original error instead of negotiation one
Kubernetes-commit: 7c83e736624d9861da44459269925e8a127f5a44
This commit is contained in:
		
							parent
							
								
									155248fb28
								
							
						
					
					
						commit
						4ad8f1d59a
					
				|  | @ -104,6 +104,12 @@ func SerializeObject(mediaType string, encoder runtime.Encoder, w http.ResponseW | |||
| func WriteObjectNegotiated(ctx request.Context, s runtime.NegotiatedSerializer, gv schema.GroupVersion, w http.ResponseWriter, req *http.Request, statusCode int, object runtime.Object) { | ||||
| 	serializer, err := negotiation.NegotiateOutputSerializer(req, s) | ||||
| 	if err != nil { | ||||
| 		// if original statusCode was not successful we need to return the original error
 | ||||
| 		// we cannot hide it behind negotiation problems
 | ||||
| 		if statusCode < http.StatusOK || statusCode >= http.StatusBadRequest { | ||||
| 			WriteRawJSON(int(statusCode), object, w) | ||||
| 			return | ||||
| 		} | ||||
| 		status := ErrorToAPIStatus(err) | ||||
| 		WriteRawJSON(int(status.Code), status, w) | ||||
| 		return | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue