@cprivitere reported that cluster-api-provider-packet experiences nil pointer errors when debugging is enabled and a request has no body. This behavior seems to have started in v0.25.1, which introduced automatic auth token redaction in debug output.
In order to redact the auth token without impacting the original request, we were cloning the request object. In order to clone the request body, we had to call request.GetBody(), but that function causes a nil pointer error if the request body is nil.
This updates the auth token redaction code to temporarily overwrite the auth token in the original request, rather than cloning the request & its potentially-nil body.
@cprivitere reported that cluster-api-provider-packet experiences nil pointer errors when debugging is enabled and a request has no body. This behavior seems to have started in v0.25.1, which introduced automatic auth token redaction in debug output.
In order to redact the auth token without impacting the original request, we were cloning the request object. In order to clone the request body, we had to call
request.GetBody()
, but that function causes a nil pointer error if the request body is nil.This updates the auth token redaction code to temporarily overwrite the auth token in the original request, rather than cloning the request & its potentially-nil body.