Merge pull request #60925 from aleksandra-malinowska/debug-curl-fix

Automatic merge from submit-queue (batch tested with PRs 60696, 60876, 60901, 60925, 60428). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Improve debug curl command

When logging debug curl command, add single quotes around URL and headers. This prevents quietly removing any parameters after '&' when running resulting command and improves formatting.

```release-note
NONE
```

Kubernetes-commit: de1a0e3249b67cd72c1a412a2688f693a0201b70
This commit is contained in:
Kubernetes Publisher 2018-03-20 13:36:21 -07:00
commit cc0ac3c0b2
2 changed files with 582 additions and 582 deletions

1160
Godeps/Godeps.json generated

File diff suppressed because it is too large Load Diff

View File

@ -331,11 +331,11 @@ func (r *requestInfo) toCurl() string {
headers := ""
for key, values := range r.RequestHeaders {
for _, value := range values {
headers += fmt.Sprintf(` -H %q`, fmt.Sprintf("%s: %s", key, value))
headers += fmt.Sprintf(` -H %q`, fmt.Sprintf("%s: '%s'", key, value))
}
}
return fmt.Sprintf("curl -k -v -X%s %s %s", r.RequestVerb, headers, r.RequestURL)
return fmt.Sprintf("curl -k -v -X%s %s '%s'", r.RequestVerb, headers, r.RequestURL)
}
// debuggingRoundTripper will display information about the requests passing