Skip to content

Commit b8e87bb

Browse files
nmischewing328
andauthored
Update to reset httpRepsonse.Body (#6948)
* Update to reset httpRepsonse.Body such that is available to client consumers via the returned httpResponse variable. * update samples Co-authored-by: William Cheng <[email protected]>
1 parent ba8a501 commit b8e87bb

20 files changed

+134
-0
lines changed

modules/openapi-generator/src/main/resources/go/api.mustache

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
_ioutil "io/ioutil"
88
_nethttp "net/http"
99
_neturl "net/url"
10+
_bytes "bytes"
1011
{{#imports}} "{{import}}"
1112
{{/imports}}
1213
)
@@ -309,6 +310,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams
309310

310311
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
311312
localVarHTTPResponse.Body.Close()
313+
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
312314
if err != nil {
313315
return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, err
314316
}

samples/client/petstore/go/go-petstore-withXml/api_another_fake.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/client/petstore/go/go-petstore-withXml/api_fake.go

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/client/petstore/go/go-petstore-withXml/api_fake_classname_tags123.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/client/petstore/go/go-petstore-withXml/api_pet.go

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/client/petstore/go/go-petstore-withXml/api_store.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/client/petstore/go/go-petstore-withXml/api_user.go

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/client/petstore/go/go-petstore/api_another_fake.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
_ioutil "io/ioutil"
1515
_nethttp "net/http"
1616
_neturl "net/url"
17+
_bytes "bytes"
1718
)
1819

1920
// Linger please
@@ -78,6 +79,7 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx _context.Context, bod
7879

7980
localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
8081
localVarHTTPResponse.Body.Close()
82+
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
8183
if err != nil {
8284
return localVarReturnValue, localVarHTTPResponse, err
8385
}

0 commit comments

Comments
 (0)