Skip to content

Commit

Permalink
show error in legacy short url create endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
vadimkibana committed Sep 6, 2021
1 parent b550916 commit 4b58fdc
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { registerGetRoute } from './short_urls/register_get_route';
import { registerDeleteRoute } from './short_urls/register_delete_route';
import { registerResolveRoute } from './short_urls/register_resolve_route';
import { registerGotoRoute } from './short_urls/register_goto_route';
import { registerShortenUrlRoute } from './short_urls/register_shorten_url_route';

export const registerUrlServiceRoutes = (
core: CoreSetup,
Expand All @@ -24,4 +25,5 @@ export const registerUrlServiceRoutes = (
registerDeleteRoute(router, url);
registerResolveRoute(router, url);
registerGotoRoute(router, core);
registerShortenUrlRoute(router, core);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/

import { CoreSetup, IRouter } from 'kibana/server';

export const registerShortenUrlRoute = (router: IRouter, core: CoreSetup) => {
core.http.resources.register(
{
path: '/api/shorten_url',
validate: {},
},
router.handleLegacyErrors(async (ctx, req, res) => {
return res.badRequest({
body: 'This endpoint is no longer supported. Please use the new URL shortening service.',
});
})
);
};

0 comments on commit 4b58fdc

Please sign in to comment.