Skip to content

Commit 553669b

Browse files
committed
Corrected the Referer value.
1 parent 97b59b7 commit 553669b

5 files changed

Lines changed: 32 additions & 29 deletions

File tree

dist/index.cjs

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

dist/index.esm.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.esm.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/fetch.js

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,29 +28,36 @@ async function fetch(url, requestOptions = {}) {
2828
const protocol = getProtocol(url);
2929

3030
protocol
31-
.get(url, Object.assign({
32-
headers: {
33-
'User-Agent': 'highcharts/export',
34-
'Referer': 'highcharts.export'
35-
}
36-
}, requestOptions || {}), (res) => {
37-
let data = '';
31+
.get(
32+
url,
33+
Object.assign(
34+
{
35+
headers: {
36+
'User-Agent': 'highcharts/export',
37+
Referer: 'highcharts/export'
38+
}
39+
},
40+
requestOptions || {}
41+
),
42+
(res) => {
43+
let data = '';
3844

39-
// A chunk of data has been received.
40-
res.on('data', (chunk) => {
41-
data += chunk;
42-
});
45+
// A chunk of data has been received.
46+
res.on('data', (chunk) => {
47+
data += chunk;
48+
});
4349

44-
// The whole response has been received.
45-
res.on('end', () => {
46-
if (!data) {
47-
reject('Nothing was fetched from the URL.');
48-
}
50+
// The whole response has been received.
51+
res.on('end', () => {
52+
if (!data) {
53+
reject('Nothing was fetched from the URL.');
54+
}
4955

50-
res.text = data;
51-
resolve(res);
52-
});
53-
})
56+
res.text = data;
57+
resolve(res);
58+
});
59+
}
60+
)
5461
.on('error', (error) => {
5562
reject(error);
5663
});

lib/highcharts.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,7 @@ export async function triggerExport(chartOptions, options, displayErrors) {
124124
let constr = options.export.constr || 'chart';
125125
constr = typeof Highcharts[constr] !== 'undefined' ? constr : 'chart';
126126

127-
Highcharts[constr](
128-
'container',
129-
finalOptions,
130-
finalCallback
131-
);
127+
Highcharts[constr]('container', finalOptions, finalCallback);
132128

133129
// Get the current global options
134130
const defaultOptions = getOptions();

0 commit comments

Comments
 (0)