Skip to content

Commit

Permalink
Update to reset httpRepsonse.Body (#6948)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
nmische and wing328 authored Aug 4, 2020
1 parent ba8a501 commit b8e87bb
Show file tree
Hide file tree
Showing 20 changed files with 134 additions and 0 deletions.
2 changes: 2 additions & 0 deletions modules/openapi-generator/src/main/resources/go/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
_ioutil "io/ioutil"
_nethttp "net/http"
_neturl "net/url"
_bytes "bytes"
{{#imports}} "{{import}}"
{{/imports}}
)
Expand Down Expand Up @@ -309,6 +310,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx _context.Context{{#hasParams

localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHTTPResponse, err
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions samples/client/petstore/go/go-petstore-withXml/api_fake.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions samples/client/petstore/go/go-petstore-withXml/api_pet.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions samples/client/petstore/go/go-petstore-withXml/api_store.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions samples/client/petstore/go/go-petstore-withXml/api_user.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions samples/client/petstore/go/go-petstore/api_another_fake.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
_ioutil "io/ioutil"
_nethttp "net/http"
_neturl "net/url"
_bytes "bytes"
)

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

localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(_bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}
Expand Down
Loading

0 comments on commit b8e87bb

Please sign in to comment.