Fix bug with empty consumer buffers which mostly affected Linux

This commit is contained in:
Matthias Neeracher 2019-10-16 17:09:30 +02:00
parent 399ec66bda
commit b7da8fc7d8
1 changed files with 1 additions and 0 deletions

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 {