MCPcopy Create free account
hub / github.com/gavv/httpexpect / newRequest

Function newRequest

request.go:115–153  ·  view source on GitHub ↗
(
	parent *chain, config Config, method, path string, pathargs ...interface{},
)

Source from the content-addressed store, hash-verified

113}
114
115func newRequest(
116 parent *chain, config Config, method, path string, pathargs ...interface{},
117) *Request {
118 config.validate()
119
120 r := &Request{
121 config: config,
122 chain: parent.clone(),
123
124 redirectPolicy: defaultRedirectPolicy,
125 maxRedirects: -1,
126
127 retryPolicy: defaultRetryPolicy,
128 retryPolicyFn: nil,
129 maxRetries: 0,
130 minRetryDelay: time.Millisecond * 50,
131 maxRetryDelay: time.Second * 5,
132 sleepFn: func(d time.Duration) <-chan time.Time {
133 return time.After(d)
134 },
135
136 query: nil,
137 queryEncoder: defaultQueryEncoder,
138
139 multipartFn: func(w io.Writer) *multipart.Writer {
140 return multipart.NewWriter(w)
141 },
142 }
143
144 opChain := r.chain.enter("")
145 defer opChain.leave()
146
147 r.initPath(opChain, path, pathargs...)
148 r.initReq(opChain, method)
149
150 r.chain.setRequest(r)
151
152 return r
153}
154
155func (r *Request) initPath(opChain *chain, path string, pathargs ...interface{}) {
156 if len(pathargs) != 0 {

Callers 5

RequestMethod · 0.85
NewRequestCFunction · 0.85
TestRequest_FailedChainFunction · 0.85
TestRequest_ConstructorsFunction · 0.85
TestRequest_PanicsFunction · 0.85

Calls 7

initPathMethod · 0.95
initReqMethod · 0.95
validateMethod · 0.80
enterMethod · 0.80
leaveMethod · 0.80
setRequestMethod · 0.80
cloneMethod · 0.45

Tested by 3

TestRequest_FailedChainFunction · 0.68
TestRequest_ConstructorsFunction · 0.68
TestRequest_PanicsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…