(
parent *chain, config Config, method, path string, pathargs ...interface{},
)
| 113 | } |
| 114 | |
| 115 | func 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 | |
| 155 | func (r *Request) initPath(opChain *chain, path string, pathargs ...interface{}) { |
| 156 | if len(pathargs) != 0 { |
searching dependent graphs…