return Response( status: .ok, headers: ["Content-Type": "text/html; charset=UTF-8"], body: Response.Body(string: html) )
View
型だとどうなってるんだろうな。public struct View: ResponseEncodable { public var data: ByteBuffer public init(data: ByteBuffer) { self.data = data } public func encodeResponse(for request: Request) -> EventLoopFuture<Response> { let response = Response() response.headers.contentType = .html response.body = .init(buffer: self.data) return request.eventLoop.makeSucceededFuture(response) } }
return view.encodeResponse(for: request).map { (response) in var response = response response.status = .notFound return response }