Skip to content

Commit fee07a9

Browse files
committed
fix curl graphql lint issue
1 parent b27a403 commit fee07a9

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

codegens/curl/lib/index.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,19 +138,18 @@ self = module.exports = {
138138
case 'raw':
139139
snippet += indent + `--data-raw ${quoteType}${sanitize(body.raw.toString(), trim, quoteType)}${quoteType}`;
140140
break;
141-
// eslint-disable-next-line no-case-declarations
142-
case 'graphql':
141+
case 'graphql':
143142
// eslint-disable-next-line no-case-declarations
144143
let query = body.graphql ? body.graphql.query : '',
145-
graphqlVariables = body.graphql ? body.graphql.variables : '{}';
144+
graphqlVariables;
146145
try {
147-
graphqlVariables = JSON.parse(graphqlVariables || '{}');
146+
graphqlVariables = JSON.parse(body.graphql.variables);
148147
}
149148
catch (e) {
150149
graphqlVariables = {};
151150
}
152151
snippet += indent + `--data-raw ${quoteType}${sanitize(JSON.stringify({
153-
query: query || '',
152+
query: query,
154153
variables: graphqlVariables
155154
}), trim, quoteType)}${quoteType}`;
156155
break;

0 commit comments

Comments
 (0)