Skip to content

Commit df77160

Browse files
fix: update the screwdriver-request lib payload (#4)
1 parent 133da2f commit df77160

File tree

3 files changed

+5
-16
lines changed

3 files changed

+5
-16
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
"sinon": "^9.0.0"
3232
},
3333
"dependencies": {
34-
"graphql-tag": "^2.12.6",
3534
"rewiremock": "^3.14.5",
3635
"screwdriver-request": "^2.0.1"
3736
},

queries.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
'use strict';
22

3-
const gql = require('graphql-tag');
4-
5-
module.exports.GetEnterpriseUserAccount = gql`
3+
module.exports.GetEnterpriseUserAccount = `
64
query GetEnterpriseUserAccount($login: String!) {
75
user(login: $login) {
86
name
@@ -25,7 +23,7 @@ module.exports.GetEnterpriseUserAccount = gql`
2523
`;
2624

2725
// needs `admin:enterprise` scope for EAU fragment
28-
module.exports.ListEnterpriseMembers = gql`
26+
module.exports.ListEnterpriseMembers = `
2927
query ListEnterpriseMembers($slug: String!, $cursor: String) {
3028
enterprise(slug: $slug) {
3129
name
@@ -68,7 +66,7 @@ module.exports.ListEnterpriseMembers = gql`
6866
}
6967
`;
7068

71-
module.exports.GetUser = gql`
69+
module.exports.GetUser = `
7270
query GetUser($login: String!) {
7371
user(login: $login) {
7472
name

sd-graphql/index.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,10 @@ class SDGraphQLClient {
4040
context: {
4141
token
4242
},
43-
json: JSON.stringify({ query, variables }),
43+
json: { query, variables },
4444
...options
4545
});
4646

47-
if (res.body.errors) {
48-
throw new Error(res.body.errors);
49-
}
50-
5147
return res.body;
5248
}
5349

@@ -68,14 +64,10 @@ class SDGraphQLClient {
6864
context: {
6965
token
7066
},
71-
json: JSON.stringify({ mutation, variables }),
67+
json: { mutation, variables },
7268
...options
7369
});
7470

75-
if (res.body.errors) {
76-
throw new Error(res.body.errors);
77-
}
78-
7971
return res.body;
8072
}
8173
}

0 commit comments

Comments
 (0)