Skip to content

Commit

Permalink
replace the double encoding by writing bytes directly to the buffer (#…
Browse files Browse the repository at this point in the history
…2043)

Co-authored-by: Cory Benfield <[email protected]>
  • Loading branch information
stepan-ulyanin and Lukasa authored Feb 9, 2022
1 parent 7000510 commit d1814ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Sources/NIOFoundationCompat/Codable+ByteBuffer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ extension JSONEncoder {
public func encodeAsByteBuffer<T: Encodable>(_ value: T, allocator: ByteBufferAllocator) throws -> ByteBuffer {
let data = try self.encode(value)
var buffer = allocator.buffer(capacity: data.count)
try buffer.writeJSONEncodable(value, encoder: self)
buffer.writeBytes(data)
return buffer
}
}

0 comments on commit d1814ea

Please sign in to comment.