-
-
Notifications
You must be signed in to change notification settings - Fork 241
Expand file tree
/
Copy pathreflect.go
More file actions
35 lines (31 loc) · 649 Bytes
/
reflect.go
File metadata and controls
35 lines (31 loc) · 649 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package httpexpect
import (
"net/http"
"reflect"
)
func refIsNil(value interface{}) bool {
defer func() {
_ = recover()
}()
return value == nil || reflect.ValueOf(value).IsNil()
}
func refIsNum(value interface{}) bool {
defer func() {
_ = recover()
}()
reflect.ValueOf(value).Convert(reflect.TypeOf(float64(0))).Float()
return true
}
func refIsHTTP(value interface{}) bool {
switch value.(type) {
case *http.Client, http.Client,
*http.Transport, http.Transport,
*http.Request, http.Request,
*http.Response, http.Response,
*http.Header, http.Header,
*http.Cookie, http.Cookie:
return true
default:
return false
}
}