Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenAPI Tools
openapi-generator
Commits
00ea7973
Commit
00ea7973
authored
3 years ago
by
Kanagat Nugusbayev
Browse files
Options
Download
Email Patches
Plain Diff
fixed response handle
parent
0695e765
github/fork/kananindzya/feature-handle-chunked-response-v530
1 merge request
!12180
Feature handle chunked response v530
Pipeline
#626
failed with stages
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache
+12
-10
...n/resources/Java/libraries/okhttp-gson/ApiClient.mustache
with
12 additions
and
10 deletions
+12
-10
modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache
+
12
-
10
View file @
00ea7973
...
...
@@ -972,16 +972,18 @@ public class ApiClient {
String respBody = null;
try {
if (response.body() != null)
if ("chunked".equals(response.header("Transfer-Encoding"))) {
BufferedSource source = response.body().source();
Buffer buffer = new Buffer();
while (!source.exhausted()) {
Long readBytes = source.read(buffer, Long.MAX_VALUE);
respBody = buffer.readString(Charset.defaultCharset());
}
} else {
respBody = response.body().string();
}
if ("chunked".equals(response.header("Transfer-Encoding"))) {
BufferedSource source = response.body().source();
Buffer buffer = new Buffer();
StringBuilder result = new StringBuilder();
while (!source.exhausted()) {
Long readBytes = source.read(buffer, Long.MAX_VALUE);
result.append(buffer.readString(Charset.defaultCharset()));
}
respBody = result.toString();
} else {
respBody = response.body().string();
}
else
respBody = null;
} catch (IOException e) {
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets