Initializervapor 4.106.3Vapor
init(data:byteBufferAllocator:)
Create a new body wrapping Data
.
init(data: Data, byteBufferAllocator: ByteBufferAllocator = ByteBufferAllocator())
Other members in extension
Type members
init(asyncStream: @escaping (AsyncBodyStreamWriter) async throws -> (), byteBufferAllocator: ByteBufferAllocator
) Creates a chunked HTTP
Response
steam usingAsyncBodyStreamWriter
.init(asyncStream: @escaping (AsyncBodyStreamWriter) async throws -> (), count: Int, byteBufferAllocator: ByteBufferAllocator
) Creates a chunked HTTP
Response
steam usingAsyncBodyStreamWriter
.init(buffer: ByteBuffer, byteBufferAllocator: ByteBufferAllocator
) Create a new body from a Swift NIO
ByteBuffer
.init(byteBufferAllocator: ByteBufferAllocator
) Creates an empty body. Useful for
GET
requests where HTTP bodies are forbidden.init(dispatchData: DispatchData, byteBufferAllocator: ByteBufferAllocator
) Create a new body wrapping
DispatchData
.init(managedAsyncStream: @escaping (AsyncBodyStreamWriter) async throws -> (), byteBufferAllocator: ByteBufferAllocator
) Creates a managed chunked HTTP
Response
steam usingAsyncBodyStreamWriter
that automtically closes or fails based if the closure throws an error or returns.init(managedAsyncStream: @escaping (AsyncBodyStreamWriter) async throws -> (), count: Int, byteBufferAllocator: ByteBufferAllocator
) Creates a managed chunked HTTP
Response
steam usingAsyncBodyStreamWriter
that automtically closes or fails based if the closure throws an error or returns.init(staticString: StaticString, byteBufferAllocator: ByteBufferAllocator
) Create a new body from the UTF8 representation of a
StaticString
.init(stream: @escaping (BodyStreamWriter) -> (), byteBufferAllocator: ByteBufferAllocator
) init(stream: @escaping (BodyStreamWriter) -> (), count: Int, byteBufferAllocator: ByteBufferAllocator
) init(string: String, byteBufferAllocator: ByteBufferAllocator
) Create a new body from the UTF8 representation of a
String
.init(stringLiteral: String
) ExpressibleByStringLiteral
conformance.static let empty: Body
An empty
Response.Body
.
Instance members
var buffer: ByteBuffer?
var count: Int
The size of the HTTP body’s data.
-1
is a chunked stream.var data: Data?
Returns static data if not streaming.
var description: String
See
CustomDebugStringConvertible
.var string: String?
func collect(on: EventLoop
) -> EventLoopFuture<ByteBuffer?>