@artilleryio/int-core 2.0.10-338b070 → 2.0.10-533da4b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/engine_http.js +19 -5
- package/package.json +2 -2
package/lib/engine_http.js
CHANGED
|
@@ -85,6 +85,10 @@ function HttpEngine(script) {
|
|
|
85
85
|
this.config.http = {};
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
if (typeof this.config.http.defaults === 'undefined') {
|
|
89
|
+
this.config.http.defaults = {};
|
|
90
|
+
}
|
|
91
|
+
|
|
88
92
|
if (typeof this.config.http.cookieJarOptions === 'undefined') {
|
|
89
93
|
this.config.http.cookieJarOptions = {};
|
|
90
94
|
}
|
|
@@ -197,7 +201,10 @@ HttpEngine.prototype.step = function step(requestSpec, ee, opts) {
|
|
|
197
201
|
}
|
|
198
202
|
|
|
199
203
|
if (typeof requestSpec.think !== 'undefined') {
|
|
200
|
-
return engineUtil.createThink(
|
|
204
|
+
return engineUtil.createThink(
|
|
205
|
+
requestSpec,
|
|
206
|
+
self.config.http.defaults.think || self.config.defaults.think
|
|
207
|
+
);
|
|
201
208
|
}
|
|
202
209
|
|
|
203
210
|
if (typeof requestSpec.log !== 'undefined') {
|
|
@@ -387,7 +394,8 @@ HttpEngine.prototype.step = function step(requestSpec, ee, opts) {
|
|
|
387
394
|
|
|
388
395
|
// Assign default headers then overwrite as needed
|
|
389
396
|
let defaultHeaders = lowcaseKeys(
|
|
390
|
-
config.defaults.headers ||
|
|
397
|
+
config.http.defaults.headers ||
|
|
398
|
+
config.defaults.headers || { 'user-agent': USER_AGENT }
|
|
391
399
|
);
|
|
392
400
|
const combinedHeaders = _.extend(
|
|
393
401
|
defaultHeaders,
|
|
@@ -811,7 +819,9 @@ function lastRequest(res, requestParams) {
|
|
|
811
819
|
HttpEngine.prototype.setInitialContext = function (initialContext) {
|
|
812
820
|
initialContext._successCount = 0;
|
|
813
821
|
|
|
814
|
-
initialContext._defaultStrictCapture =
|
|
822
|
+
initialContext._defaultStrictCapture =
|
|
823
|
+
this.config.http.defaults.strictCapture ||
|
|
824
|
+
this.config.defaults.strictCapture;
|
|
815
825
|
initialContext._jar = new tough.CookieJar(
|
|
816
826
|
null,
|
|
817
827
|
this.config.http.cookieJarOptions
|
|
@@ -819,8 +829,12 @@ HttpEngine.prototype.setInitialContext = function (initialContext) {
|
|
|
819
829
|
|
|
820
830
|
initialContext._enableCookieJar = false;
|
|
821
831
|
// If a default cookie is set, we will use the jar straightaway:
|
|
822
|
-
if (
|
|
823
|
-
|
|
832
|
+
if (
|
|
833
|
+
typeof this.config.http.defaults.cookie === 'object' ||
|
|
834
|
+
typeof this.config.defaults.cookie === 'object'
|
|
835
|
+
) {
|
|
836
|
+
initialContext._defaultCookie =
|
|
837
|
+
this.config.http.defaults.cookie || this.config.defaults.cookie;
|
|
824
838
|
initialContext._enableCookieJar = true;
|
|
825
839
|
}
|
|
826
840
|
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@artilleryio/int-core",
|
|
3
|
-
"version": "2.0.10-
|
|
3
|
+
"version": "2.0.10-533da4b",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@artilleryio/int-commons": "2.0.0-
|
|
6
|
+
"@artilleryio/int-commons": "2.0.0-533da4b",
|
|
7
7
|
"@artilleryio/sketches-js": "^2.1.1",
|
|
8
8
|
"agentkeepalive": "^4.1.0",
|
|
9
9
|
"arrivals": "^2.1.2",
|