hof 21.0.1-axios-beta → 21.0.3-axios-beta

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+ const url = require('url');
3
+
4
+ module.exports = (settings, body)=>{
5
+ return Object.assign({}, settings, {
6
+ 'url' : settings.uri || settings.url || url.format(settings),
7
+ 'data': settings.body || body || settings.data,
8
+ });
9
+ }
@@ -9,6 +9,8 @@ module.exports = class PDFModel extends Model {
9
9
  const settings = super.requestConfig(options);
10
10
  settings.encoding = null;
11
11
  settings.rejectUnauthorized = false;
12
+ settings.responseType = 'arraybuffer';
13
+ console.log("settings---------------: ", settings);
12
14
  return settings;
13
15
  }
14
16
 
package/model/index.js CHANGED
@@ -6,6 +6,8 @@ const axios = require('axios').default;
6
6
  const url = require('url');
7
7
  const EventEmitter = require('events').EventEmitter;
8
8
 
9
+ const axiosSetting = require('./apis/axios-settings')
10
+
9
11
  const REFERENCE = /^\$ref:/;
10
12
 
11
13
  function timeDiff(from, to, d) {
@@ -90,10 +92,10 @@ module.exports = class Model extends EventEmitter {
90
92
  callback = body;
91
93
  body = undefined;
92
94
  }
95
+
93
96
  let settings = Object.assign({}, originalSettings);
94
97
  settings.timeout = settings.timeout || this.options.timeout;
95
- settings.url = settings.uri || settings.url || url.format(settings);
96
- settings.data = settings.body || body || settings.data;
98
+ settings = axiosSetting(settings, body)
97
99
  settings = _.omit(settings, urlKeys);
98
100
  this.emit('sync', originalSettings);
99
101
 
@@ -135,7 +137,7 @@ module.exports = class Model extends EventEmitter {
135
137
  resolve(data);
136
138
  }
137
139
  };
138
-
140
+ console.log("settings---------------: ", settings);
139
141
  this._request(settings)
140
142
  .then(response => {
141
143
  return this.handleResponse(response, (error, data, status) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hof",
3
3
  "description": "A bootstrap for HOF projects",
4
- "version": "21.0.1-axios-beta",
4
+ "version": "21.0.3-axios-beta",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "author": "HomeOffice",
@@ -33,7 +33,7 @@
33
33
  "test:cucumber": "cucumber-js -f @cucumber/pretty-formatter \"sandbox/test/_features/**/*.feature\" --require sandbox/test/_features/test.setup.js --require \"sandbox/test/_features/step_definitions/**/*.js\" --tags $TAGS",
34
34
  "ci": "travis-conditions",
35
35
  "postversion": "git push && git push --tags",
36
- "test-single":"mocha"
36
+ "test-single": "mocha"
37
37
  },
38
38
  "dependencies": {
39
39
  "aliasify": "^2.1.0",
@@ -82,6 +82,7 @@
82
82
  "nodemailer-smtp-transport": "^2.7.4",
83
83
  "nodemailer-stub-transport": "^1.1.0",
84
84
  "notifications-node-client": "^6.0.0",
85
+ "object-mapper": "^6.2.0",
85
86
  "redis": "^3.1.2",
86
87
  "reqres": "^3.0.1",
87
88
  "rimraf": "^3.0.2",