No flags found
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
78c8e6c
... +4 ...
3ede394
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
193 | 193 | return (str && str[0].toUpperCase()) + str.substring(1); |
|
194 | 194 | } |
|
195 | 195 | ||
196 | - | function getHttpsAgent(options) { |
|
196 | + | function getHttpsAgent(options, reqOpts) { |
|
197 | 197 | var key = getCacheKey(options); |
|
198 | 198 | var agent = httpsAgents.get(key); |
|
199 | - | var headers = options.headers || {}; |
|
200 | - | if (!agent) { |
|
201 | - | options.proxyAuth = options.auth; |
|
202 | - | options.rejectUnauthorized = config.rejectUnauthorized; |
|
203 | - | var originProxyHeaders = {}; |
|
199 | + | if (reqOpts) { |
|
200 | + | var headers = options.headers || {}; |
|
201 | + | var proxyHeaders = {}; |
|
204 | 202 | Object.keys(headers).forEach(function(key) { |
|
205 | 203 | var rawKey = key.split('-').map(capitalize).join('-'); |
|
206 | - | originProxyHeaders[rawKey] = headers[key]; |
|
204 | + | proxyHeaders[rawKey] = headers[key]; |
|
207 | 205 | }); |
|
208 | - | headers = originProxyHeaders; |
|
206 | + | reqOpts._tunnelProxyHeaders = proxyHeaders; |
|
207 | + | } |
|
208 | + | if (!agent) { |
|
209 | + | options.proxyAuth = options.auth; |
|
210 | + | options.rejectUnauthorized = config.rejectUnauthorized; |
|
209 | 211 | options.proxy = { |
|
210 | 212 | host: options.proxyHost, |
|
211 | - | port: options.proxyPort, |
|
212 | - | headers: headers |
|
213 | + | port: options.proxyPort |
|
213 | 214 | }; |
|
214 | 215 | var agentName = options.isHttps ? 'httpsOverHttp' : 'httpOverHttp'; |
|
215 | 216 | if (options.proxyServername) { |
|
216 | 217 | options.proxy.servername = options.proxyServername; |
|
217 | 218 | agentName += 's'; |
|
218 | 219 | } |
|
219 | 220 | agent = new tunnel[agentName](options); |
|
220 | - | agent.originProxyHeaders = headers; |
|
221 | 221 | httpsAgents.set(key, agent); |
|
222 | 222 | agent.on('free', preventThrowOutError); |
|
223 | 223 | var createSocket = agent.createSocket; |
227 | 227 | cb(socket); |
|
228 | 228 | }); |
|
229 | 229 | }; |
|
230 | - | } else if (agent.originProxyHeaders) { |
|
231 | - | if (headers['user-agent']) { |
|
232 | - | agent.originProxyHeaders['User-Agent'] = headers['user-agent']; |
|
233 | - | } else { |
|
234 | - | delete agent.originProxyHeaders['User-Agent']; |
|
235 | - | } |
|
236 | - | if (headers['proxy-authorization']) { |
|
237 | - | agent.originProxyHeaders['Proxy-Authorization'] = headers['proxy-authorization']; |
|
238 | - | } else { |
|
239 | - | delete agent.originProxyHeaders['Proxy-Authorization']; |
|
240 | - | } |
|
241 | 230 | } |
|
242 | 231 | return agent; |
|
243 | 232 | } |
146 | 146 | ||
147 | 147 | function setProxyAgent(options, proxyOpts) { |
|
148 | 148 | proxyOpts.cacheKey = options.cacheKey; |
|
149 | - | options.agent = proxyOpts.isSocks ? config.getSocksAgent(proxyOpts) : config.getHttpsAgent(proxyOpts); |
|
149 | + | options.agent = proxyOpts.isSocks ? config.getSocksAgent(proxyOpts) : config.getHttpsAgent(proxyOpts, options); |
|
150 | 150 | } |
|
151 | 151 | ||
152 | 152 | module.exports = function(req, res, next) { |
3ede394
8f5330a
a4b12d5
a8737b1
8d74e22
78c8e6c