From 3f33ef369f7b3620b87d21ada72e75166c461cdf Mon Sep 17 00:00:00 2001 From: Peter Tolsma Date: Mon, 5 Jul 2021 02:05:16 -0500 Subject: [PATCH] Make ByteBuffer unconditionally use zero-copy for JSON Decoding (#1889) --- Sources/NIOFoundationCompat/Codable+ByteBuffer.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/NIOFoundationCompat/Codable+ByteBuffer.swift b/Sources/NIOFoundationCompat/Codable+ByteBuffer.swift index 6dd25750..8f0f0746 100644 --- a/Sources/NIOFoundationCompat/Codable+ByteBuffer.swift +++ b/Sources/NIOFoundationCompat/Codable+ByteBuffer.swift @@ -28,7 +28,7 @@ extension ByteBuffer { public func getJSONDecodable(_ type: T.Type, decoder: JSONDecoder = JSONDecoder(), at index: Int, length: Int) throws -> T? { - guard let data = self.getData(at: index, length: length) else { + guard let data = self.getData(at: index, length: length, byteTransferStrategy: .noCopy) else { return nil } return try decoder.decode(T.self, from: data)