Skip to content

Commit

Permalink
test: fixed graphql tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniomuso committed Aug 29, 2023
1 parent b44eb1d commit d540309
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions packages/gitlab-backend/src/service/router.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ describe('createRouter', () => {
headers: {
'accept-encoding': 'gzip, deflate',
connection: 'close',
'content-length': '0',
'content-length': '2',
'content-type': 'application/json',
host: 'non-existing-example.com',
'user-agent': 'supertest',
},
Expand All @@ -171,7 +172,8 @@ describe('createRouter', () => {
headers: {
'accept-encoding': 'gzip, deflate',
connection: 'close',
'content-length': '0',
'content-length': '2',
'content-type': 'application/json',
host: 'non-existing-example-2.com',
'user-agent': 'supertest',
},
Expand Down Expand Up @@ -411,7 +413,8 @@ describe('createRouter with baseUrl', () => {
headers: {
'accept-encoding': 'gzip, deflate',
connection: 'close',
'content-length': '0',
'content-length': '2',
'content-type': 'application/json',
host: 'non-existing-example.com',
'user-agent': 'supertest',
},
Expand All @@ -431,7 +434,8 @@ describe('createRouter with baseUrl', () => {
headers: {
'accept-encoding': 'gzip, deflate',
connection: 'close',
'content-length': '0',
'content-length': '2',
'content-type': 'application/json',
host: 'non-existing-example-2.com',
'user-agent': 'supertest',
},
Expand Down
2 changes: 1 addition & 1 deletion packages/gitlab-backend/src/service/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export async function createRouter(

const graphqlFilter = (_pathname: string, req: Request): boolean => {
if (req.headers['authorization']) delete req.headers['authorization'];
return req.method === 'POST' && !req.body.query.includes('mutation');
return req.method === 'POST' && !req.body.query?.includes('mutation');
};

for (const { host, apiBaseUrl, token } of gitlabIntegrations) {
Expand Down

0 comments on commit d540309

Please sign in to comment.