Skip to content

Conversation

@roycaihw
Copy link

PR checklist

  • Read the contribution guidelines.
  • Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • Filed the PR against the correct branch: 3.0.0 branch for changes related to OpenAPI spec 3.0. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.
    @wing328 @antihax

Description of the PR

Like python client #4166, we want Go API client to not read response content and return the http.Response with Body not closed, to support streaming responses. This PR add a separate method for each operation to keep current behavior.

Alternatives considered:

  1. Add a stream boolean parameter to current method: this would break current behavior, and the methods still have returnType in function signature, which is not flexible (e.g. you cannot use different operation methods as same parameter)
  2. Break the current method into two steps: func (a *SomeApiService) GetFooRawResp(...) (FooResponseStruct) and func (f *FooResponseStruct) DecodeFooResponse() (Foo, *http.Response, error), where FooResponseStruct contains the raw http response and error. The downside is same as the first one
  3. Break the current method into two methods of (a *SomeApiService): func (a *SomeApiService) GetFooRawResp(...) (*http.Response, error) and func (f *FooResponseStruct) DecodeFooResponse(*http.Response) (Foo, *http.Response, error). Flexible, but breaks current behavior.

@roycaihw roycaihw force-pushed the go-stream-response branch 2 times, most recently from 3b1cd13 to 39e039a Compare May 17, 2018 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants