| 332 | } |
| 333 | |
| 334 | initGotEnv(opts) { |
| 335 | this.got = this.got ? this.got : require('got') |
| 336 | this.cktough = this.cktough ? this.cktough : require('tough-cookie') |
| 337 | this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar() |
| 338 | if (opts) { |
| 339 | opts.headers = opts.headers ? opts.headers : {} |
| 340 | if (opts) { |
| 341 | opts.headers = opts.headers ? opts.headers : {} |
| 342 | if ( |
| 343 | undefined === opts.headers.cookie && |
| 344 | undefined === opts.headers.Cookie && |
| 345 | undefined === opts.cookieJar |
| 346 | ) { |
| 347 | opts.cookieJar = this.ckjar |
| 348 | } |
| 349 | } |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | get(request, callback = () => {}) { |
| 354 | if (request.headers) { |