Skip to content

Commit

Permalink
feat: improve http request for tls
Browse files Browse the repository at this point in the history
  • Loading branch information
houseme committed Feb 21, 2023
1 parent 7bba945 commit 079ec82
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions feie.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ package feie
import (
"context"
"crypto/sha1"
"crypto/tls"
"encoding/hex"
"errors"
"os"
Expand Down Expand Up @@ -208,12 +209,14 @@ func (f *FeiE) doRequest(ctx context.Context, formData map[string]string) error
formData[SigField] = f.sha1Sign()
f.logger.Debug(ctx, "formData:", formData)
f.request.SetMultipartFormData(formData)
f.request.SetRequestURI(gateway)
f.request.SetRequestURI(f.op.Gateway)
f.request.Header.SetMethod(consts.MethodPost)
f.request.Header.SetUserAgentBytes(userAgent)
f.request.Header.SetUserAgentBytes(f.op.UserAgent)
f.logger.Debug(ctx, "request content: ", f.request)

c, err := client.NewClient()
c, err := client.NewClient(client.WithTLSConfig(&tls.Config{
InsecureSkipVerify: true,
}), client.WithDialTimeout(f.op.TimeOut))
if err != nil {
return err
}
Expand Down

0 comments on commit 079ec82

Please sign in to comment.