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

2.x.x - How to disallow HBResponseBodyWriter from being used outside HBResponseBody.write. #342

Open
adam-fowler opened this issue Jan 11, 2024 · 3 comments

Comments

@adam-fowler
Copy link
Member

No description provided.

@adam-fowler
Copy link
Member Author

Can we add a swift 6 conditional conformance to ~Escapable

@MahdiBM
Copy link
Contributor

MahdiBM commented Aug 13, 2024

It appears the consensus around the SwiftNIO team is to use a with...() { } type method for these stuff.
See: swift-server/async-http-client#752

(I'm taking a guess at what you mean by this issue, so disregard this comment if what I mentioned is unrelated)

@adam-fowler
Copy link
Member Author

@MahdiBM I'm guessing something like this

var writerCopy: ResponseBodyWriter
let response = Response(
    status: .ok, 
    body: .init { writer in
        writerCopy = writer
    }
)
try await writerCopy.write(anotherByteBuffer)

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