Skip to content

Commit

Permalink
[Core] Add different request lib to telemetry_analytics in place of…
Browse files Browse the repository at this point in the history
… `$http` (elastic#49671)

* Add axios to telemetry_analytics in place of .

* Remove axios in favor of fetch.
  • Loading branch information
justinkambic committed Oct 31, 2019
1 parent 824707e commit 1f6363c
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,20 @@ interface AnalyicsReporterConfig {
}

export function createAnalyticsReporter(config: AnalyicsReporterConfig) {
const { localStorage, basePath, $http, debug } = config;
const { localStorage, basePath, debug } = config;

return createReporter({
debug,
storage: localStorage,
async http(report) {
const url = `${basePath}/api/telemetry/report`;
await $http.post(url, { report });
await fetch(url, {
method: 'POST',
headers: {
'kbn-xsrf': 'true',
},
body: JSON.stringify({ report }),
});
},
});
}

0 comments on commit 1f6363c

Please sign in to comment.