Skip to content

remove extra line appended in auto-generated code #779

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion codegens/csharp-httpclient/lib/CodeBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class CodeBuilder {
extra = '';
}
this.currentIndentCount--;
this.snippet += this.indentation + '}' + extra + this.newLineChar;
this.snippet += this.indentation + '}' + extra;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion codegens/dart-http/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ self = module.exports = {
}
headerSnippet += 'import \'package:http/http.dart\' as http;\n\n';
headerSnippet += 'void main() async {\n';
footerSnippet = '}\n';
footerSnippet = '}';
}

// The following code handles multiple files in the same formdata param.
Expand Down
2 changes: 1 addition & 1 deletion codegens/java-unirest/lib/unirest.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function makeSnippet (request, indentString, options) {
});
}
snippet += parseRequest.parseBody(request, indentString, options.trimRequestBody);
snippet += indentString + '.asString();\n';
snippet += indentString + '.asString();';

return snippet;
}
Expand Down
2 changes: 1 addition & 1 deletion codegens/libcurl/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ self = module.exports = {
snippet += indentString + 'curl_slist_free_all(headers);\n';
}
snippet += '}\n';
snippet += 'curl_easy_cleanup(curl);\n';
snippet += 'curl_easy_cleanup(curl);';
(options.includeBoilerplate) &&
(snippet = indentString + snippet.split('\n').join('\n' + indentString));
callback(null, headerSnippet + snippet + footerSnippet);
Expand Down
4 changes: 2 additions & 2 deletions codegens/nodejs-axios/lib/axios.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function makeSnippet (request, indentString, options) {
snippet += indentString.repeat(2) + 'console.log(error);\n';
snippet += indentString + '}\n';
snippet += '}\n\n';
snippet += 'makeRequest();\n';
snippet += 'makeRequest();';
}
else {
snippet += 'axios.request(config)\n';
Expand All @@ -145,7 +145,7 @@ function makeSnippet (request, indentString, options) {
snippet += '})\n';
snippet += '.catch((error) => {\n';
snippet += indentString + 'console.log(error);\n';
snippet += '});\n';
snippet += '});';
}

return snippet;
Expand Down
2 changes: 1 addition & 1 deletion codegens/nodejs-request/lib/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function makeSnippet (request, indentString, options) {
}
snippet += indentString + 'if (error) throw new Error(error);\n';
snippet += indentString + 'console.log(response.body);\n';
snippet += '});\n';
snippet += '});';
return snippet;
}

Expand Down
2 changes: 1 addition & 1 deletion codegens/nodejs-unirest/lib/unirest.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ function makeSnippet (request, indentString, options) {
}
snippet += indentString.repeat(2) + 'if (res.error) throw new Error(res.error); \n';
snippet += indentString.repeat(2) + 'console.log(res.raw_body);\n';
snippet += indentString + '});\n';
snippet += indentString + '});';

return snippet;
}
Expand Down
2 changes: 1 addition & 1 deletion codegens/php-curl/lib/php-curl.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ self = module.exports = {
snippet += '));\n\n';
snippet += '$response = curl_exec($curl);\n\n';
snippet += 'curl_close($curl);\n';
snippet += 'echo $response;\n';
snippet += 'echo $response;';

return callback(null, snippet);
}
Expand Down
4 changes: 2 additions & 2 deletions codegens/php-guzzle/lib/phpGuzzle.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function getSnippetFooterSync (includeRequestOptions) {
'echo $res->getBody();\n';
}
return '$res = $client->send($request, $options);\n' +
'echo $res->getBody();\n';
'echo $res->getBody();';
}

/**
Expand All @@ -179,7 +179,7 @@ function getSnippetFooterAsync (includeRequestOptions) {
'echo $res->getBody();\n';
}
return '$res = $client->sendAsync($request, $options)->wait();\n' +
'echo $res->getBody();\n';
'echo $res->getBody();';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion codegens/php-pecl-http/lib/phpPecl.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ self = module.exports = {
snippet += `${getHeaders(request, indentation)}\n`;
snippet += '$client->enqueue($request)->send();\n';
snippet += '$response = $client->getResponse();\n';
snippet += 'echo $response->getBody();\n';
snippet += 'echo $response->getBody();';

return callback(null, snippet);
}
Expand Down
2 changes: 1 addition & 1 deletion codegens/python-requests/lib/python-requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ self = module.exports = {
snippet += !options.followRedirect ? ', allow_redirects=False' : '';
snippet += options.requestTimeout !== 0 ? `, timeout=${options.requestTimeout}` : '';
snippet += ')\n\n';
snippet += 'print(response.text)\n';
snippet += 'print(response.text)';

callback(null, snippet);
}
Expand Down
4 changes: 2 additions & 2 deletions codegens/ruby/lib/ruby.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ self = module.exports = {
}
snippet += `${parseBody(request.toJSON(), options.trimRequestBody, contentType, options.indentCount)}\n`;
snippet += 'response = https.request(request)\n';
snippet += 'puts response.read_body\n';
snippet += 'puts response.read_body';
}
else {
snippet += 'http = Net::HTTP.new(url.host, url.port);\n';
Expand Down Expand Up @@ -226,7 +226,7 @@ self = module.exports = {
}
snippet += `${parseBody(request.toJSON(), options.trimRequestBody, contentType, options.indentCount)}\n`;
snippet += 'response = http.request(request)\n';
snippet += 'puts response.read_body\n';
snippet += 'puts response.read_body';
}

return callback(null, snippet);
Expand Down
2 changes: 1 addition & 1 deletion codegens/swift/lib/swift.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ self = module.exports = {
codeSnippet += `${indent}print(String(data: data, encoding: .utf8)!)\n`;
codeSnippet += options.includeBoilerplate ? `${indent}exit(EXIT_SUCCESS)\n` : '';
codeSnippet += '}\n\n';
codeSnippet += 'task.resume()\n';
codeSnippet += 'task.resume()' + options.includeBoilerplate ? '\n' : '';
codeSnippet += options.includeBoilerplate ? 'dispatchMain()\n' : '';

return callback(null, codeSnippet);
Expand Down