[Grokdebugger] Fix grokdebugger simulate call in non-default s… (#61423)

This commit is contained in:
Jean-Louis Leysens 2020-03-27 11:35:22 +01:00 committed by GitHub
parent 5b8de94616
commit 3373bb8613
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,19 +4,19 @@
* you may not use this file except in compliance with the Elastic License.
*/
import chrome from 'ui/chrome';
import { ROUTES } from '../../../common/constants';
import { GrokdebuggerResponse } from 'plugins/grokdebugger/models/grokdebugger_response';
export class GrokdebuggerService {
constructor(http) {
this.http = http;
this.basePath = chrome.addBasePath(ROUTES.API_ROOT);
}
simulate(grokdebuggerRequest) {
return this.http
.post(`${this.basePath}/simulate`, { body: JSON.stringify(grokdebuggerRequest.upstreamJSON) })
.post(`${ROUTES.API_ROOT}/simulate`, {
body: JSON.stringify(grokdebuggerRequest.upstreamJSON),
})
.then(response => {
return GrokdebuggerResponse.fromUpstreamJSON(response.grokdebuggerResponse);
})