Skip to content

Commit

Permalink
added default headers option to shared library payload;
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdanfinn committed Sep 3, 2023
1 parent a82dd73 commit a2937f0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cffi_src/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,10 @@ func getTlsClient(requestInput RequestInput, sessionId string, withSession bool)
options = append(options, tls_client.WithInsecureSkipVerify())
}

if requestInput.DefaultHeaders != nil && len(requestInput.DefaultHeaders) != 0 {
options = append(options, tls_client.WithDefaultHeaders(requestInput.DefaultHeaders))
}

if requestInput.ServerNameOverwrite != nil && *requestInput.ServerNameOverwrite != "" {
options = append(options, tls_client.WithServerNameOverwrite(*requestInput.ServerNameOverwrite))
}
Expand Down
1 change: 1 addition & 0 deletions cffi_src/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type RequestInput struct {
ForceHttp1 bool `json:"forceHttp1"`
HeaderOrder []string `json:"headerOrder"`
Headers map[string]string `json:"headers"`
DefaultHeaders map[string][]string `json:"defaultHeaders"`
InsecureSkipVerify bool `json:"insecureSkipVerify"`
IsByteRequest bool `json:"isByteRequest"`
IsByteResponse bool `json:"isByteResponse"`
Expand Down
1 change: 1 addition & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func NewHttpClient(logger Logger, options ...HttpClientOption) (HttpClient, erro
followRedirects: true,
badPinHandler: nil,
customRedirectFunc: nil,
defaultHeaders: make(http.Header),
clientProfile: DefaultClientProfile,
timeout: time.Duration(DefaultTimeoutSeconds) * time.Second,
}
Expand Down

0 comments on commit a2937f0

Please sign in to comment.