Skip to content

Commit a3c4fd8

Browse files
committed
Adding consistent quoting to js-fetch codegen output.
1 parent b08da32 commit a3c4fd8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

codegens/js-fetch/lib/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ function convert (request, options, callback) {
305305
codeSnippet += `const timerId = setTimeout(() => controller.abort(), ${options.requestTimeout});\n`;
306306
}
307307
optionsSnippet = `const requestOptions = {\n${indent}`;
308-
optionsSnippet += `method: '${request.method}',\n${indent}`;
308+
optionsSnippet += `method: "${request.method}",\n${indent}`;
309309
if (headerSnippet !== '') {
310310
optionsSnippet += `headers: myHeaders,\n${indent}`;
311311
codeSnippet += headerSnippet + '\n';
@@ -318,7 +318,7 @@ function convert (request, options, callback) {
318318
if (options.requestTimeout > 0) {
319319
optionsSnippet += `signal: controller.signal,\n${indent}`;
320320
}
321-
optionsSnippet += `redirect: '${redirectMode(options.followRedirect)}'\n};\n`;
321+
optionsSnippet += `redirect: "${redirectMode(options.followRedirect)}"\n};\n`;
322322

323323
codeSnippet += optionsSnippet + '\n';
324324

codegens/js-fetch/test/unit/convert.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ describe('js-fetch convert function for test collection', function () {
9494
return;
9595
}
9696
expect(snippet).to.be.a('string');
97-
expect(snippet).to.include('redirect: \'manual\'');
97+
expect(snippet).to.include('redirect: "manual"');
9898
});
9999
});
100100

@@ -110,7 +110,7 @@ describe('js-fetch convert function for test collection', function () {
110110
return;
111111
}
112112
expect(snippet).to.be.a('string');
113-
expect(snippet).to.include('redirect: \'follow\'');
113+
expect(snippet).to.include('redirect: "follow"');
114114
});
115115
});
116116

0 commit comments

Comments
 (0)