@@ -4,7 +4,7 @@ const FETCH_ERROR_MSG = 'Requested resource returned a non 200 status code'
4
4
5
5
const config = require ( './config' )
6
6
const wreck = require ( '@hapi/wreck' ) . defaults ( {
7
- timeout : config . httpTimeoutMs
7
+ // timeout: config.httpTimeoutMs
8
8
} )
9
9
let wreckExt
10
10
@@ -16,9 +16,15 @@ if (config.http_proxy) {
16
16
}
17
17
18
18
const { performance } = require ( 'node:perf_hooks' )
19
- const get = ( url , options , ext = false ) => {
19
+ const get = ( url , options = { } , ext = false ) => {
20
20
const thisWreck = ( ext && wreckExt ) ? wreckExt : wreck
21
21
const startTick = performance . now ( )
22
+ // Header with UA added for AWS WAF as it is required
23
+ options . headers = {
24
+ ...options . headers ,
25
+ 'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'
26
+ }
27
+
22
28
return thisWreck . get ( url , options )
23
29
. then ( response => {
24
30
if ( config . performanceLogging ) {
@@ -38,9 +44,15 @@ const get = (url, options, ext = false) => {
38
44
} )
39
45
}
40
46
41
- const post = ( url , options , ext = false ) => {
47
+ const post = ( url , options = { } , ext = false ) => {
42
48
const thisWreck = ( ext && wreckExt ) ? wreckExt : wreck
43
49
const startTick = performance . now ( )
50
+ // Header with UA added for AWS WAF as it is required
51
+ options . headers = {
52
+ ...options . headers ,
53
+ 'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3'
54
+ }
55
+
44
56
return thisWreck . post ( url , options )
45
57
. then ( response => {
46
58
if ( config . performanceLogging ) {
0 commit comments