Return error when client headers are missing (issue #19)
Compare changes
- michael.minelli authored
+ 26
− 13
@@ -16,6 +16,7 @@ import GitlabProfile from '../shared/types/Gitlab/GitlabProfile';
@@ -16,6 +16,7 @@ import GitlabProfile from '../shared/types/Gitlab/GitlabProfile';
@@ -97,11 +98,11 @@ class GitlabManager {
@@ -97,11 +98,11 @@ class GitlabManager {
async createRepository(name: string, description: string, visibility: string, initializeWithReadme: boolean, namespace: number, sharedRunnersEnabled: boolean, wikiEnabled: boolean, import_url: string): Promise<GitlabRepository> {
const response = await axios.post<GitlabRepository>(this.getApiUrl(GitlabRoute.REPOSITORY_CREATE), {
@@ -112,8 +113,8 @@ class GitlabManager {
@@ -112,8 +113,8 @@ class GitlabManager {
return await axios.delete(this.getApiUrl(GitlabRoute.REPOSITORY_DELETE).replace('{{id}}', String(repoId)));
async forkRepository(forkId: number, name: string, path: string, description: string, visibility: string, namespace: number): Promise<GitlabRepository> {
@@ -134,8 +135,8 @@ class GitlabManager {
@@ -134,8 +135,8 @@ class GitlabManager {
async changeRepositoryVisibility(repoId: number, visibility: GitlabVisibility): Promise<GitlabRepository> {
async addRepositoryMember(repoId: number, userId: number, accessLevel: GitlabAccessLevel): Promise<GitlabMember> {
@@ -169,16 +170,18 @@ class GitlabManager {
@@ -169,16 +170,18 @@ class GitlabManager {
async checkTemplateAccess(projectIdOrNamespace: string, req: express.Request): Promise<StatusCodes> {
if ( [ GitlabVisibility.PUBLIC.valueOf(), GitlabVisibility.INTERNAL.valueOf() ].includes(project.visibility) ) {
@@ -197,7 +200,13 @@ class GitlabManager {
@@ -197,7 +200,13 @@ class GitlabManager {
return isUsersAtLeastReporter.user && isUsersAtLeastReporter.dojo ? StatusCodes.OK : StatusCodes.UNAUTHORIZED;
async protectBranch(repoId: number, branchName: string, allowForcePush: boolean, allowedToMerge: GitlabAccessLevel, allowedToPush: GitlabAccessLevel, allowedToUnprotect: GitlabAccessLevel): Promise<GitlabMember> {
@@ -240,8 +249,12 @@ class GitlabManager {
@@ -240,8 +249,12 @@ class GitlabManager {
const response = await axios.get<GitlabFile>(this.getApiUrl(GitlabRoute.REPOSITORY_FILE).replace('{{id}}', String(repoId)).replace('{{filePath}}', encodeURIComponent(filePath)), {
@@ -253,7 +266,7 @@ class GitlabManager {
@@ -253,7 +266,7 @@ class GitlabManager {
private async createUpdateFile(create: boolean, repoId: number, filePath: string, fileBase64: string, commitMessage: string, branch: string = 'main', authorName: string = 'Dojo', authorMail: string | undefined = undefined) {
await axiosFunction(this.getApiUrl(GitlabRoute.REPOSITORY_FILE).replace('{{id}}', String(repoId)).replace('{{filePath}}', encodeURIComponent(filePath)), {
@@ -272,7 +285,7 @@ class GitlabManager {
@@ -272,7 +285,7 @@ class GitlabManager {
async deleteFile(repoId: number, filePath: string, commitMessage: string, branch: string = 'main', authorName: string = 'Dojo', authorMail: string | undefined = undefined) {
await axios.delete(this.getApiUrl(GitlabRoute.REPOSITORY_FILE).replace('{{id}}', String(repoId)).replace('{{filePath}}', encodeURIComponent(filePath)), {