hof 21.0.0-axios-beta → 21.0.0-axios-beta.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,39 +5,38 @@
5
5
  <head>
6
6
  <meta charset="utf-8" />
7
7
  <title>{{ pageTitle }}</title>
8
+ {{{ head }}}
8
9
 
9
10
  <link rel="shortcut icon" sizes="16x16 32x32 48x48" href="{{assetPath}}images/favicon.ico" type="image/x-icon">
10
- <link rel="mask-icon" href="{{assetPath}}images/govuk-mask-icon.svg" color="#0b0c0c">
11
+ <link rel="mask-icon" href="{{assetPath}}images/govuk-mask-icon.svg" color="#0b0c0c">
11
12
  <link rel="apple-touch-icon" sizes="180x180" href="{{assetPath}}images/govuk-apple-touch-icon-180x180.png">
12
13
  <link rel="apple-touch-icon" sizes="167x167" href="{{assetPath}}images/govuk-apple-touch-icon-167x167.png">
13
14
  <link rel="apple-touch-icon" sizes="152x152" href="{{assetPath}}images/govuk-apple-touch-icon-152x152.png">
14
15
  <link rel="apple-touch-icon" href="{{assetPath}}images/govuk-apple-touch-icon.png">
15
-
16
-
16
+
17
+
17
18
  <meta name="theme-color" content="#0b0c0c" />
18
19
 
19
20
  <meta name="viewport" content="width=device-width, initial-scale=1">
20
21
 
21
- {{{ head }}}
22
-
23
-
22
+
24
23
  <meta property="og:image" content="{{assetPath}}images/opengraph-image.png">
25
24
  </head>
26
25
 
27
26
  <body class="{{ bodyClasses }} govuk-template__body js-enabled" >
28
27
  <script>document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');</script>
29
28
 
30
-
29
+
31
30
 
32
31
  <div id="global-cookie-message" class="gem-c-cookie-banner govuk-clearfix" data-module="cookie-banner" role="region" aria-label="cookie banner" data-nosnippet="">
33
32
  {{{ cookieMessage }}}
34
33
  </div>
35
-
36
- {{{ bodyStart }}}
37
-
34
+
35
+ {{{ bodyStart }}}
36
+
38
37
  <header role="banner" id="govuk-header" class="{{{ headerClass }}}">
39
38
  <div class="govuk-header__container govuk-width-container">
40
-
39
+
41
40
  <div class="govuk-header__logo">
42
41
  <a href="{{{ homepageUrl }}}" title="{{ logoLinkTitle }}" id="logo" class="govuk-header__link govuk-header__link--homepage" target="_blank" data-module="track-click" data-track-category="homeLinkClicked" data-track-action="homeHeader">
43
42
  <span class="govuk-header__logotype">
@@ -57,11 +56,11 @@
57
56
  </a>
58
57
  </div>
59
58
  {{{ insideHeader }}}
60
-
59
+
61
60
  {{{ propositionHeader }}}
62
61
  </div>
63
62
  </header>
64
-
63
+
65
64
 
66
65
  {{{ afterHeader }}}
67
66
 
@@ -81,7 +80,7 @@
81
80
  <svg aria-hidden="true" focusable="false" class="govuk-footer__licence-logo" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 483.2 195.7" height="17" width="41">
82
81
  <path fill="currentColor" d="M421.5 142.8V.1l-50.7 32.3v161.1h112.4v-50.7zm-122.3-9.6A47.12 47.12 0 0 1 221 97.8c0-26 21.1-47.1 47.1-47.1 16.7 0 31.4 8.7 39.7 21.8l42.7-27.2A97.63 97.63 0 0 0 268.1 0c-36.5 0-68.3 20.1-85.1 49.7A98 98 0 0 0 97.8 0C43.9 0 0 43.9 0 97.8s43.9 97.8 97.8 97.8c36.5 0 68.3-20.1 85.1-49.7a97.76 97.76 0 0 0 149.6 25.4l19.4 22.2h3v-87.8h-80l24.3 27.5zM97.8 145c-26 0-47.1-21.1-47.1-47.1s21.1-47.1 47.1-47.1 47.2 21 47.2 47S123.8 145 97.8 145"></path>
83
82
  </svg>
84
-
83
+
85
84
  <span class="govuk-footer__licence-description">{{{ licenceMessage }}}</span>
86
85
  </div>
87
86
 
@@ -93,12 +92,12 @@
93
92
  </footer>
94
93
 
95
94
  <div id="global-app-error" class="app-error hidden"></div>
96
-
95
+
97
96
 
98
97
  {{{ bodyEnd }}}
99
-
100
-
98
+
99
+
101
100
  <script {{#nonce}}nonce="{{nonce}}"{{/nonce}}>if (typeof window.GOVUK === 'undefined') document.body.className = document.body.className.replace('js-enabled', '');</script>
102
-
101
+
103
102
  </body>
104
103
  </html>
@@ -18,10 +18,10 @@
18
18
  <textarea name="{{id}}" id="{{id}}"
19
19
  class="govuk-textarea {{#isMaxlengthOrMaxword}}govuk-js-character-count{{/isMaxlengthOrMaxword}} {{#className}}{{className}}{{/className}} {{#error}}govuk-input--error{{/error}}"
20
20
  {{#isMaxlengthOrMaxword}}
21
- aria-describedby="{{id}}-info"
21
+ aria-describedby="{{id}}-hint {{id}}-info"
22
22
  {{/isMaxlengthOrMaxword}}
23
- {{#attributes}}
24
- {{attribute}}="{{value}}"
23
+ {{#attributes}}
24
+ {{attribute}}="{{value}}"
25
25
  {{/attributes}}
26
26
  {{^error}}{{#hintId}}{{#maxlength}} aria-describedby="{{id}}-maxlength-hint {{hintId}}"{{/maxlength}}{{/hintId}}{{/error}}
27
27
  {{^error}}{{#hintId}}{{^maxlength}} aria-describedby="{{hintId}}"{{/maxlength}}{{/hintId}}{{/error}}
@@ -34,7 +34,6 @@
34
34
  ga('govuk_shared.send', 'pageview')
35
35
  {{/gaCrossDomainTrackingTagId}}
36
36
  }
37
-
38
37
  </script>
39
38
  {{/gaTagId}}
40
39
 
@@ -1,2 +1,30 @@
1
+ {{#gtmTagId}}
2
+ {{#cookiesAccepted}}
3
+ {{#isETA}}
4
+ <!-- Google Tag Manager Data Layer for ETA -->
5
+ <script {{#nonce}}nonce="{{nonce}}"{{/nonce}}>
6
+ var dataLayer = window.dataLayer || [];
7
+ dataLayer.push({
8
+ 'event': 'pageLoad',
9
+ 'pageName': 'ETA | Customer Contact Webform | {{gtm-page}}',
10
+ 'applicationType': 'ETA | Customer Contact',
11
+ 'environmentType': '{{environmentType}}'
12
+ });
13
+ </script>
14
+ <!-- End Google Tag Manager Data Layer for ETA -->
15
+ {{/isETA}}
16
+
17
+ <!-- Google Tag Manager -->
18
+ <script {{#nonce}}nonce="{{nonce}}"{{/nonce}}>
19
+ (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
20
+ new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
21
+ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
22
+ 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
23
+ })(window,document,'script','dataLayer','{{gtmTagId}}');
24
+ </script>
25
+ <!-- End Google Tag Manager -->
26
+ {{/cookiesAccepted}}
27
+ {{/gtmTagId}}
28
+
1
29
  <meta name="format-detection" content="telephone=no">
2
30
  <link rel="stylesheet" href="{{assetPath}}/css/app.css">
@@ -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
+ }
@@ -17,17 +17,18 @@ module.exports = class PDFModel extends Model {
17
17
  }
18
18
 
19
19
  handleResponse(response, callback) {
20
- if (isPdf(Buffer.from(response.body))) {
21
- return this.parseResponse(response.statusCode, response.body, callback);
20
+ if (isPdf(Buffer.from(response.data))) {
21
+ return this.parseResponse(response.status, response.data, callback);
22
22
  }
23
23
  const err = new Error();
24
- if (parseInt(response.statusCode, 10) === 400) {
25
- err.title = response.body.code;
26
- err.message = response.body.message;
24
+
25
+ if (parseInt(response.status, 10) === 400) {
26
+ err.title = response.status;
27
+ err.message = response.statusText;
27
28
  } else {
28
- err.body = response.body;
29
+ err.body = response.data;
29
30
  }
30
- err.status = response.statusCode;
31
- return callback(err, null, response.statusCode);
31
+ err.status = response.status;
32
+ return callback(err, null, response.status);
32
33
  }
33
34
  };
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
+
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.0-axios-beta",
4
+ "version": "21.0.0-axios-beta.1",
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",