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

Double sendBody in DataResponse #22

Closed
andyvanosdale opened this issue Aug 8, 2017 · 3 comments
Closed

Double sendBody in DataResponse #22

andyvanosdale opened this issue Aug 8, 2017 · 3 comments

Comments

@andyvanosdale
Copy link

Just curious, is this supposed to call sendBody with an empty Data? I don't see any comments around it why it would do that.

https://github.com/envoy/Ambassador/blob/master/Ambassador/Responses/DataResponse.swift#L81

            if !data.isEmpty {
                sendBody(data)
            }
-->         sendBody(Data())
@andyvanosdale
Copy link
Author

Nevermind... #19 answered my question.

@fangpenlin
Copy link
Contributor

@enozero sending an empty data means EOF (end of file), or close the connection.

As you may want to send data chunks, at one point you want to tell Embassy to close the connection, then you send an empty data.

@andyvanosdale
Copy link
Author

That makes perfect sense. Thanks!

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

No branches or pull requests

2 participants