-
Notifications
You must be signed in to change notification settings - Fork 113
Add ControlPlaneRequestEncoder #239
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
Conversation
c31cd9e
to
af3e1c1
Compare
self.byteBuffer.writeString(.userAgentHeader) | ||
self.byteBuffer.writeContentLengthHeader(length: contentLength) | ||
self.byteBuffer.writeString(.CRLF) // end of head | ||
if contentLength > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if let payload = payload && contentLength > 0
could be nice so we can drop the force unwrap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
|
||
mutating func writerAdded(context: ChannelHandlerContext) { | ||
self.byteBuffer = context.channel.allocator.buffer(capacity: 256) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😎
Add a new
ControlPlaneRequestEncoder
that encodes all requests into an existing buffer.Motivation:
We want to write our request to the ControlPlaneAPI into one buffer, that we can reuse over and over.
Modifications:
ControlPlaneRequestEncoder
that writesControlPlaneRequest
s into a buffer that is reused.Result: