Skip to content
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

feat(gen): no NPE on default stream responses #876

Closed
wants to merge 3 commits into from

Conversation

natehart
Copy link
Contributor

Requires #875 to be merged first.

The current implementation of the templated stream response `Read(byte[])` function uses the `Data io.Reader` field without first checking for `nil`.

Users who want to return a value with an empty body are forced to explicitly specify an empty `io.Reader` rather than simply ignore the field and get use from the empty struct.

This commit adds a `nil` check before using the `Data` field and, if it is `nil`, responds as if it were an empty `io.Reader` instead of panicking.

This will hopefully make this library slightly more ergonomic to use.
@ernado ernado changed the title chore: commit generated files feat(gen): no NPE on default stream responses #875 Apr 25, 2023
@ernado ernado changed the title feat(gen): no NPE on default stream responses #875 feat(gen): no NPE on default stream responses Apr 25, 2023
@ernado ernado closed this Apr 25, 2023
@natehart natehart deleted the generate-examples branch April 25, 2023 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants