Skip to content

Commit

Permalink
use /internal prefix for migrate endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
pgayvallet committed Feb 25, 2020
1 parent a79485d commit 318fa14
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class KbnClientSavedObjects {

return await this.requester.request<MigrateResponse>({
description: 'migrate saved objects',
path: uriencode`/api/saved_objects/_migrate`,
path: uriencode`/internal/saved_objects/_migrate`,
method: 'POST',
body: {},
});
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-pm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43791,7 +43791,7 @@ class KbnClientSavedObjects {
this.log.debug('Migrating saved objects');
return await this.requester.request({
description: 'migrate saved objects',
path: kbn_client_requester_1.uriencode `/api/saved_objects/_migrate`,
path: kbn_client_requester_1.uriencode `/internal/saved_objects/_migrate`,
method: 'POST',
body: {},
});
Expand Down
5 changes: 4 additions & 1 deletion src/core/server/saved_objects/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,8 @@ export function registerRoutes({
registerExportRoute(router, config, importableExportableTypes);
registerImportRoute(router, config, importableExportableTypes);
registerResolveImportErrorsRoute(router, config, importableExportableTypes);
registerMigrateRoute(router, migratorPromise);

const internalRouter = http.createRouter('/internal/saved_objects/');

registerMigrateRoute(internalRouter, migratorPromise);
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const config = {
maxImportExportSize: 10000,
} as SavedObjectConfig;

describe('POST /api/saved_objects/_import', () => {
describe('POST /internal/saved_objects/_import', () => {
let server: setupServerReturn['server'];
let httpSetup: setupServerReturn['httpSetup'];
let handlerContext: setupServerReturn['handlerContext'];
Expand All @@ -51,7 +51,7 @@ describe('POST /api/saved_objects/_import', () => {

savedObjectsClient.find.mockResolvedValue(emptyResponse);

const router = httpSetup.createRouter('/api/saved_objects/');
const router = httpSetup.createRouter('/internal/saved_objects/');
registerImportRoute(router, config, allowedTypes);

await server.start();
Expand All @@ -63,7 +63,7 @@ describe('POST /api/saved_objects/_import', () => {

it('formats successful response', async () => {
const result = await supertest(httpSetup.server.listener)
.post('/api/saved_objects/_import')
.post('/internal/saved_objects/_import')
.set('content-Type', 'multipart/form-data; boundary=BOUNDARY')
.send(
[
Expand Down Expand Up @@ -99,7 +99,7 @@ describe('POST /api/saved_objects/_import', () => {
});

const result = await supertest(httpSetup.server.listener)
.post('/api/saved_objects/_import')
.post('/internal/saved_objects/_import')
.set('content-Type', 'multipart/form-data; boundary=EXAMPLE')
.send(
[
Expand Down Expand Up @@ -148,7 +148,7 @@ describe('POST /api/saved_objects/_import', () => {
});

const result = await supertest(httpSetup.server.listener)
.post('/api/saved_objects/_import')
.post('/internal/saved_objects/_import')
.set('content-Type', 'multipart/form-data; boundary=EXAMPLE')
.send(
[
Expand Down Expand Up @@ -199,7 +199,7 @@ describe('POST /api/saved_objects/_import', () => {
});

const result = await supertest(httpSetup.server.listener)
.post('/api/saved_objects/_import')
.post('/internal/saved_objects/_import')
.set('content-Type', 'multipart/form-data; boundary=EXAMPLE')
.send(
[
Expand Down Expand Up @@ -249,7 +249,7 @@ describe('POST /api/saved_objects/_import', () => {
});

const result = await supertest(httpSetup.server.listener)
.post('/api/saved_objects/_import')
.post('/internal/saved_objects/_import')
.set('content-Type', 'multipart/form-data; boundary=EXAMPLE')
.send(
[
Expand Down

0 comments on commit 318fa14

Please sign in to comment.