func checkPostResponse(resp *http.Response, body []byte, req *http.Request, to types.ID) error {
	switch resp.StatusCode {
	case http.StatusPreconditionFailed:
		switch strings.TrimSuffix(string(body), "\n") {
		case errIncompatibleVersion.Error():
			plog.Errorf("request sent was ignored by peer %s (server version incompatible)", to)
			return errIncompatibleVersion
		case errClusterIDMismatch.Error():
			plog.Errorf("request sent was ignored (cluster ID mismatch: remote[%s]=%s, local=%s)",
				to, resp.Header.Get("X-Etcd-Cluster-ID"), req.Header.Get("X-Etcd-Cluster-ID"))
			return errClusterIDMismatch
		default:
			return fmt.Errorf("unhandled error %q when precondition failed", string(body))
		}
	case http.StatusForbidden:
		return errMemberRemoved
	case http.StatusNoContent:
		return nil
	default:
		return fmt.Errorf("unexpected http status %s while posting to %q", http.StatusText(resp.StatusCode), req.URL.String())
	}
}
func checkPostResponse(resp *http.Response, body []byte, req *http.Request, to types.ID) error {
	switch resp.StatusCode {
	case http.StatusPreconditionFailed:
		switch strings.TrimSuffix(string(body), "\n") {
		case errIncompatibleVersion.Error():
			plog.Errorf("request sent was ignored by peer %s (server version incompatible)", to)
			return errIncompatibleVersion
		case errClusterIDMismatch.Error():
			plog.Errorf("request sent was ignored (cluster ID mismatch: remote[%s]=%s, local=%s)",
				to, resp.Header.Get("X-Etcd-Cluster-ID"), req.Header.Get("X-Etcd-Cluster-ID"))
			return errClusterIDMismatch
		default:
			return fmt.Errorf("unhandled error %q when precondition failed", string(body))
		}
	case http.StatusForbidden:
		return errMemberRemoved
	case http.StatusNoContent:
		return nil
	default:
		return fmt.Errorf("unexpected http status %s while posting to %q", http.StatusText(resp.StatusCode), req.URL.String())
	}
}
func checkPostResponse ( resp * http . Response , body [ ] byte , req * http . Request , to types . ID ) error { switch resp . StatusCode { case http . StatusPreconditionFailed : switch strings . TrimSuffix ( string ( body ) , " \n " ) { case errIncompatibleVersion . Error ( ) : plog . Errorf ( " " , to ) return errIncompatibleVersion case errClusterIDMismatch . Error ( ) : plog . Errorf ( " " , to , resp . Header . Get ( " " ) , req . Header . Get ( " " ) ) return errClusterIDMismatch default : return fmt . Errorf ( " " , string ( body ) ) } case http . StatusForbidden : return errMemberRemoved case http . StatusNoContent : return nil default : return fmt . Errorf ( " " , http . StatusText ( resp . StatusCode ) , req . URL . String ( ) ) } }
// checkPostResponse checks the response of the HTTP POST request that sends
// raft message.
checkPostResponse checks the response of the HTTP POST request that sends raft message .