Skip to content

Commit

Permalink
fix Request.AddTLSConfig method (#16)
Browse files Browse the repository at this point in the history
Co-authored-by: sedmess <>
  • Loading branch information
sedmess authored Mar 16, 2021
1 parent e3c027f commit ffc26ac
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion request/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func (r *Request) AddURLEncodedForm(data interface{}) *Request {
// AddTLSConfig ...
func (r *Request) AddTLSConfig(data *tls.Config) *Request {
return r.
use(BodyURLEncodedForm{Data: data})
use(TLSConfig{data})
}

// AddTransform ...
Expand Down
13 changes: 13 additions & 0 deletions request/request_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package request

import (
"crypto/tls"
"testing"
)

Expand Down Expand Up @@ -39,3 +40,15 @@ func TestRequest_Form(t *testing.T) {
t.Error(resp.Error())
}
}

func TestRequest_AddTLSConfig(t *testing.T) {
resp := New().
POST("http://httpbin.org/post").
AddHeader(map[string]string{"Google": "google"}).
AddBasicAuth("google", "google").
AddTLSConfig(&tls.Config{InsecureSkipVerify: false}).
Send()
if !resp.OK() {
t.Error(resp.Error()) //unknown urlencoded type: *tls.Config
}
}

0 comments on commit ffc26ac

Please # to comment.