-
Notifications
You must be signed in to change notification settings - Fork 103
/
export_test.go
83 lines (61 loc) · 1.55 KB
/
export_test.go
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package httpmock
import (
"io"
"net/http"
"reflect"
"sync/atomic"
"github.com/jarcoal/httpmock/internal"
)
var (
GetPackage = getPackage
ExtractPackage = extractPackage
CalledFrom = calledFrom
)
type (
MatchResponder = matchResponder
MatchResponders = matchResponders
)
func init() {
atomic.AddInt64(&matcherID, 0xabcdef)
}
func GetIgnorePackages() map[string]bool {
return ignorePackages
}
// bodyCopyOnRead
func NewBodyCopyOnRead(body io.ReadCloser) *bodyCopyOnRead { //nolint: revive
return &bodyCopyOnRead{body: body}
}
func (b *bodyCopyOnRead) Body() io.ReadCloser {
return b.body
}
func (b *bodyCopyOnRead) Rearm() {
b.rearm()
}
// matchRouteKey
func NewMatchRouteKey(rk internal.RouteKey, name string) matchRouteKey { //nolint: revive
return matchRouteKey{RouteKey: rk, name: name}
}
// matchResponder
func NewMatchResponder(matcher Matcher, resp Responder) matchResponder { //nolint: revive
return matchResponder{matcher: matcher, responder: resp}
}
func (mr matchResponder) ResponderPointer() uintptr {
return reflect.ValueOf(mr.responder).Pointer()
}
func (mr matchResponder) Matcher() Matcher {
return mr.matcher
}
// matchResponders
func (mrs matchResponders) Add(mr matchResponder) matchResponders {
return mrs.add(mr)
}
func (mrs matchResponders) Remove(name string) matchResponders {
return mrs.remove(name)
}
func (mrs matchResponders) FindMatchResponder(req *http.Request) *matchResponder {
return mrs.findMatchResponder(req)
}
// Matcher
func (m Matcher) FnPointer() uintptr {
return reflect.ValueOf(m.fn).Pointer()
}