Fix bug with empty consumer buffers which mostly affected Linux

This commit is contained in:
2019-10-16 17:09:30 +02:00
parent 399ec66bda
commit 5b9f9fcb9d

View File

@@ -44,6 +44,7 @@ public struct GzipServerMiddleware: Middleware, ServiceType {
return data.subdata(in: offset..<offset+readSize)
},
consumer: { data -> Void in
guard data.count > 0 else { return } // Skip empty buffers
var buffer = ByteBufferAllocator().buffer(capacity: bufSize)
buffer.write(bytes: data)
write = write.flatMap {