mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
* Upgrade Hapi in legacy platform to v17 (#21707) * Disable even-better monitoring * Upgrade to Hapi v15 * Upgrade to Hapi v16 * Handle optional req params correctly * Update http and kbnServer * Get mocha tests passing * Convert `reply` usages [wip] * Fix Joi and Plugin incompatibilities * Get server up and running * Get basic logging working * Fix optimizer * Fix recent route handlers * Various fixes * Fix recent routes * Upgrade wreck for async/await * Fix mocha tests * Fix joi issues * Fix xpack jest tests * Fix recent routes * Fix tests * Fix index setup * Decouple monitoring stats collection from good plugin * Update reload logging test to work * Reimplement logging with updated good plugin * Fix unit tests * Fix getConnections back * Make LegacyLoggingServer compatible with Hapi v17 * Update joi types * Fix x-pack unit tests * Remove stray debugger * Remove hapi-compat * Fix API integrations * Upgrade boom * Fix security plugin * Misc fixes * bump * Fix licensePreRoutingFactory * Fix failing integration tests * Remove unnecessary test change * Remove hapi-latest package * fx * Various cleanup * Fix race condition in oppsy events * Use elastic/good fork * Fix boom.wrap and hapi-latest changes * Simplify LegacyLoggingServer updates * package.json cleanup + test fix * yarn.lock cleanup * Change good tag * Fixes * Change return err -> throw err in routes * Fix await returns * Fix new load_data test * Make cookie security flags consistent * tmp doc * Fix types * Fix tests * Upgrade canvas plugin * Move good package to published @elastic/good one * Fix SO test * Fix logging reloading * Update APM apis * Fix error logging * Fix logging test * Convert spaces plugin * Add validation error shim * Remove 7.0 release notes * Await renderApp * Fix ccr routes * Prevent header popovers from scrolling with page content (#23850) * Fix spaces test * new yarn.lock-s * Fix spaces tests * Remove h2o2-latest * Fix @types/hapi * Upgrade InfraOps plugin * Fix package.json * Add back isSameSite: false * Upgrade beats_management plugin * Update snapshot * Fix InfraOps * Upgrade kql_telemetry * Merge upstream/master * Upgrade apm and ml * Put snapshot test back * Fx beats * Upgrade rollups * Update boom usages in new plugins * Update url shortener * Don't throw errors in optimizer (#24660)
This commit is contained in:
parent
fe94151059
commit
306d06c0e9
362 changed files with 3027 additions and 3490 deletions
|
@ -14,5 +14,5 @@ import Boom from 'boom';
|
|||
* @return Object Boom error response
|
||||
*/
|
||||
export function wrapEsError(err) {
|
||||
return Boom.wrap(err, err.statusCode);
|
||||
return Boom.boomify(err, { statusCode: err.statusCode });
|
||||
}
|
||||
|
|
|
@ -34,31 +34,29 @@ describe('license_pre_routing_factory', () => {
|
|||
};
|
||||
});
|
||||
|
||||
it ('replies with 403', (done) => {
|
||||
it('replies with 403', async () => {
|
||||
const licensePreRouting = licensePreRoutingFactory(mockServer);
|
||||
const stubRequest = {};
|
||||
licensePreRouting(stubRequest, (response) => {
|
||||
expect(() => licensePreRouting(stubRequest)).to.throwException((response) => {
|
||||
expect(response).to.be.an(Error);
|
||||
expect(response.isBoom).to.be(true);
|
||||
expect(response.output.statusCode).to.be(403);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('isAvailable is true', () => {
|
||||
describe('isAvailable is true', async () => {
|
||||
beforeEach(() => {
|
||||
mockLicenseCheckResults = {
|
||||
isAvailable: true
|
||||
};
|
||||
});
|
||||
|
||||
it ('replies with nothing', (done) => {
|
||||
it('replies with forbidden', async () => {
|
||||
const licensePreRouting = licensePreRoutingFactory(mockServer);
|
||||
const stubRequest = {};
|
||||
licensePreRouting(stubRequest, (response) => {
|
||||
expect(() => licensePreRouting(stubRequest)).to.throwException((response) => {
|
||||
expect(response).to.eql(Boom.forbidden());
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -11,13 +11,13 @@ export const licensePreRoutingFactory = (server) => {
|
|||
const xpackMainPlugin = server.plugins.xpack_main;
|
||||
|
||||
// License checking and enable/disable logic
|
||||
function licensePreRouting(request, reply) {
|
||||
function licensePreRouting() {
|
||||
const licenseCheckResults = xpackMainPlugin.info.feature(PLUGIN.ID).getLicenseCheckResults();
|
||||
if (!licenseCheckResults.enableAPIRoute) {
|
||||
reply(Boom.forbidden(licenseCheckResults.message));
|
||||
} else {
|
||||
reply();
|
||||
throw Boom.forbidden(licenseCheckResults.message);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return licensePreRouting;
|
||||
|
|
|
@ -22,15 +22,15 @@ export function registerGrokSimulateRoute(server) {
|
|||
server.route({
|
||||
path: '/api/grokdebugger/simulate',
|
||||
method: 'POST',
|
||||
handler: (request, reply) => {
|
||||
handler: (request) => {
|
||||
const callWithRequest = callWithRequestFactory(server, request);
|
||||
const grokdebuggerRequest = GrokdebuggerRequest.fromDownstreamJSON(request.payload);
|
||||
return simulateGrok(callWithRequest, grokdebuggerRequest.upstreamJSON)
|
||||
.then((simulateResponseFromES) => {
|
||||
const grokdebuggerResponse = GrokdebuggerResponse.fromUpstreamJSON(simulateResponseFromES);
|
||||
reply({ grokdebuggerResponse });
|
||||
return { grokdebuggerResponse };
|
||||
})
|
||||
.catch(e => reply(wrapEsError(e)));
|
||||
.catch(e => wrapEsError(e));
|
||||
},
|
||||
config: {
|
||||
pre: [ licensePreRouting ]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue