mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
refactor(core): Move curl endpoint to its own controller (no-changelog) (#9605)
This commit is contained in:
committed by
GitHub
parent
375b347b0f
commit
1563bf571d
@@ -22,10 +22,11 @@ import { Queue } from '@/Queue';
|
||||
import { WorkflowsController } from '@/workflows/workflows.controller';
|
||||
import { EDITOR_UI_DIST_DIR, inDevelopment, inE2ETests, N8N_VERSION, Time } from '@/constants';
|
||||
import { CredentialsController } from '@/credentials/credentials.controller';
|
||||
import type { APIRequest, CurlHelper } from '@/requests';
|
||||
import type { APIRequest } from '@/requests';
|
||||
import { registerController } from '@/decorators';
|
||||
import { AuthController } from '@/controllers/auth.controller';
|
||||
import { BinaryDataController } from '@/controllers/binaryData.controller';
|
||||
import { CurlController } from '@/controllers/curl.controller';
|
||||
import { DynamicNodeParametersController } from '@/controllers/dynamicNodeParameters.controller';
|
||||
import { MeController } from '@/controllers/me.controller';
|
||||
import { MFAController } from '@/controllers/mfa.controller';
|
||||
@@ -45,7 +46,6 @@ import type { ICredentialsOverwrite } from '@/Interfaces';
|
||||
import { CredentialsOverwrites } from '@/CredentialsOverwrites';
|
||||
import { LoadNodesAndCredentials } from '@/LoadNodesAndCredentials';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import { toHttpNodeParameters } from '@/CurlConverterHelper';
|
||||
import { EventBusController } from '@/eventbus/eventBus.controller';
|
||||
import { EventBusControllerEE } from '@/eventbus/eventBus.controller.ee';
|
||||
import { LicenseController } from '@/license/license.controller';
|
||||
@@ -69,7 +69,6 @@ import { OrchestrationController } from './controllers/orchestration.controller'
|
||||
import { WorkflowHistoryController } from './workflows/workflowHistory/workflowHistory.controller.ee';
|
||||
import { InvitationController } from './controllers/invitation.controller';
|
||||
// import { CollaborationService } from './collaboration/collaboration.service';
|
||||
import { BadRequestError } from './errors/response-errors/bad-request.error';
|
||||
import { OrchestrationService } from '@/services/orchestration.service';
|
||||
import { ProjectController } from './controllers/project.controller';
|
||||
import { RoleController } from './controllers/role.controller';
|
||||
@@ -150,6 +149,7 @@ export class Server extends AbstractServer {
|
||||
AIController,
|
||||
ProjectController,
|
||||
RoleController,
|
||||
CurlController,
|
||||
];
|
||||
|
||||
if (
|
||||
@@ -266,23 +266,6 @@ export class Server extends AbstractServer {
|
||||
this.logger.warn(`Source Control initialization failed: ${error.message}`);
|
||||
}
|
||||
|
||||
// ----------------------------------------
|
||||
// curl-converter
|
||||
// ----------------------------------------
|
||||
this.app.post(
|
||||
`/${this.restEndpoint}/curl-to-json`,
|
||||
ResponseHelper.send(async (req: CurlHelper.ToJson) => {
|
||||
const curlCommand = req.body.curlCommand ?? '';
|
||||
|
||||
try {
|
||||
const parameters = toHttpNodeParameters(curlCommand);
|
||||
return ResponseHelper.flattenObject(parameters, 'parameters');
|
||||
} catch (e) {
|
||||
throw new BadRequestError('Invalid cURL command');
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
||||
// ----------------------------------------
|
||||
// Options
|
||||
// ----------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user