func readRequest(r io.Reader, contentType string) (*admissionapi.AdmissionRequest, error) {
	if contentType != contentTypeJSON {
		return nil, fmt.Errorf("Content-Type=%s, expected %s", contentType, contentTypeJSON)
	}

	// Can we read the body?
	if r == nil {
		return nil, fmt.Errorf("no body")
	}
	body, err := ioutil.ReadAll(r)
	if err != nil {
		return nil, fmt.Errorf("read body: %v", err)
	}

	// Can we convert the body into an AdmissionReview?
	var ar admissionapi.AdmissionReview
	deserializer := codecs.UniversalDeserializer()
	if _, _, err := deserializer.Decode(body, nil, &ar); err != nil {
		return nil, fmt.Errorf("decode body: %v", err)
	}
	return ar.Request, nil
}
func readRequest(r io.Reader, contentType string) (*admissionapi.AdmissionRequest, error) {
	if contentType != contentTypeJSON {
		return nil, fmt.Errorf("Content-Type=%s, expected %s", contentType, contentTypeJSON)
	}

	
	if r == nil {
		return nil, fmt.Errorf("no body")
	}
	body, err := ioutil.ReadAll(r)
	if err != nil {
		return nil, fmt.Errorf("read body: %v", err)
	}

	
	var ar admissionapi.AdmissionReview
	deserializer := codecs.UniversalDeserializer()
	if _, _, err := deserializer.Decode(body, nil, &ar); err != nil {
		return nil, fmt.Errorf("decode body: %v", err)
	}
	return ar.Request, nil
}
func readRequest ( r io . Reader , contentType string ) ( * admissionapi . AdmissionRequest , error ) { if contentType != contentTypeJSON { return nil , fmt . Errorf ( " " , contentType , contentTypeJSON ) } // Can we read the body? if r == nil { return nil , fmt . Errorf ( " " ) } body , err := ioutil . ReadAll ( r ) if err != nil { return nil , fmt . Errorf ( " " , err ) } // Can we convert the body into an AdmissionReview? var ar admissionapi . AdmissionReview deserializer := codecs . UniversalDeserializer ( ) if _ , _ , err := deserializer . Decode ( body , nil , & ar ) ; err != nil { return nil , fmt . Errorf ( " " , err ) } return ar . Request , nil }
// readRequest extracts the request from the AdmissionReview reader
readRequest extracts the request from the AdmissionReview reader