Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/services/checkmarx/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('CheckmarxClient', () => {
});

await expect(client.listProjects()).resolves.toEqual([]);
expect(checkmarx).toHaveBeenCalledWith('/api/projects', { params: { limit: 100 } });
expect(checkmarx).toHaveBeenCalledWith('projects', { params: { limit: 100 } });
});

it('returns an empty scan list when Checkmarx responds with null', async () => {
Expand All @@ -31,7 +31,7 @@ describe('CheckmarxClient', () => {
});

await expect(client.listScans({ projectId: 'project-id', last: 25 })).resolves.toEqual([]);
expect(checkmarx).toHaveBeenCalledWith('/api/scans', {
expect(checkmarx).toHaveBeenCalledWith('scans', {
params: { limit: 25, 'project-id': 'project-id' }
});
});
Expand Down
10 changes: 5 additions & 5 deletions src/services/checkmarx/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class CheckmarxClient {
constructor(private http: HttpClient) {}

async listProjects(): Promise<CxOneProject[]> {
const res = await this.http.checkmarx<CxOneProjectsResponse>('/api/projects', { params: { limit: 100 } });
const res = await this.http.checkmarx<CxOneProjectsResponse>('projects', { params: { limit: 100 } });
const projects = res.projects ?? [];
if (res.filteredTotalCount > projects.length) {
process.stderr.write(`warning: ${res.filteredTotalCount} projects found; only showing first ${projects.length}\n`);
Expand All @@ -20,13 +20,13 @@ export class CheckmarxClient {
}

async getProject(id: string): Promise<CxOneProject> {
return this.http.checkmarx<CxOneProject>(`/api/projects/${id}`);
return this.http.checkmarx<CxOneProject>(`projects/${id}`);
}

async listScans(opts: { projectId?: string; last?: number } = {}): Promise<CxOneScan[]> {
const params: Record<string, string | number> = { limit: opts.last ?? 100 };
if (opts.projectId) params['project-id'] = opts.projectId;
const res = await this.http.checkmarx<CxOneScansResponse>('/api/scans', { params });
const res = await this.http.checkmarx<CxOneScansResponse>('scans', { params });
const scans = res.scans ?? [];
if (res.filteredTotalCount > scans.length) {
process.stderr.write(`warning: ${res.filteredTotalCount} scans found; only showing first ${scans.length}\n`);
Expand All @@ -35,11 +35,11 @@ export class CheckmarxClient {
}

async getScan(id: string): Promise<CxOneScan> {
return this.http.checkmarx<CxOneScan>(`/api/scans/${id}`);
return this.http.checkmarx<CxOneScan>(`scans/${id}`);
}

async getScanResultsStatistics(scanId: string): Promise<CxOneResultsSummary> {
return this.http.checkmarx<CxOneResultsSummary>('/api/results/summary', {
return this.http.checkmarx<CxOneResultsSummary>('results/summary', {
params: { 'scan-id': scanId }
});
}
Expand Down
Loading