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` (#49671) (#49888)

* Add axios to telemetry_analytics in place of .

* Remove axios in favor of fetch.
  • Loading branch information
justinkambic authored Oct 31, 2019
1 parent 37caa67 commit 6a13a97
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 6a13a97

Please sign in to comment.