MCPcopy Create free account
hub / github.com/imroc/req / SetRootCertsFromFile

Method SetRootCertsFromFile

client.go:304–314  ·  view source on GitHub ↗

SetRootCertsFromFile set root certificates from files.

(pemFiles ...string)

Source from the content-addressed store, hash-verified

302
303// SetRootCertsFromFile set root certificates from files.
304func (c *Client) SetRootCertsFromFile(pemFiles ...string) *Client {
305 for _, pemFile := range pemFiles {
306 rootPemData, err := os.ReadFile(pemFile)
307 if err != nil {
308 c.log.Errorf("failed to read root cert file: %v", err)
309 return c
310 }
311 c.appendRootCertData(rootPemData)
312 }
313 return c
314}
315
316// GetTLSClientConfig return the underlying tls.Config.
317func (c *Client) GetTLSClientConfig() *tls.Config {

Callers 2

TestSetRootCertFromFileFunction · 0.80
SetRootCertsFromFileFunction · 0.80

Calls 2

appendRootCertDataMethod · 0.95
ErrorfMethod · 0.65

Tested by 1

TestSetRootCertFromFileFunction · 0.64