go-openapi / runtime

openapi runtime interfaces
Apache License 2.0
245 stars 146 forks source link

[Help wanted] Don't verify cert #196

Open smutel opened 3 years ago

smutel commented 3 years ago

Hello,

I am using this piece of code:

defaultScheme := []string{scheme}

t := runtimeclient.New(url, client.DefaultBasePath, defaultScheme)
t.DefaultAuthentication = runtimeclient.APIKeyAuth(authHeaderName, "header",
    fmt.Sprintf(authHeaderFormat, token))
return client.New(t, strfmt.Default), nil

I would like to add an option to not verify SSL cert. What is the easiest way to accomplish this ?

Thanks.

casualjim commented 3 years ago

construct your client with this: https://github.com/go-openapi/runtime/blob/master/client/runtime.go#L86

smutel commented 3 years ago

I am not an expert in Go. Could you please tell me how to put the struct TLSClientOptions in my code ?

fredbi commented 9 months ago

@smutel You can create a TLSClient with TLSClientOption, which accepts several options:

Use: client.TLSClient(client.TLSClientOption{InsecureSkipVerify: true})