Skip to content

Commit

Permalink
Support tls-skip-verify for output-curl-string (#11713)
Browse files Browse the repository at this point in the history
  • Loading branch information
riptl authored Jun 14, 2021
1 parent f8d255e commit f2723af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,10 @@ START:
}

if outputCurlString {
LastOutputStringError = &OutputStringError{Request: req}
LastOutputStringError = &OutputStringError{
Request: req,
TLSSkipVerify: c.config.HttpClient.Transport.(*http.Transport).TLSClientConfig.InsecureSkipVerify,
}
return nil, LastOutputStringError
}

Expand Down
4 changes: 4 additions & 0 deletions api/output_string.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var LastOutputStringError *OutputStringError

type OutputStringError struct {
*retryablehttp.Request
TLSSkipVerify bool
parsingError error
parsedCurlString string
}
Expand All @@ -39,6 +40,9 @@ func (d *OutputStringError) parseRequest() {

// Build cURL string
d.parsedCurlString = "curl "
if d.TLSSkipVerify {
d.parsedCurlString += "--insecure "
}
if d.Request.Method != "GET" {
d.parsedCurlString = fmt.Sprintf("%s-X %s ", d.parsedCurlString, d.Request.Method)
}
Expand Down

0 comments on commit f2723af

Please sign in to comment.