Skip to content

Commit

Permalink
fix breaking changes for rc.5
Browse files Browse the repository at this point in the history
  • Loading branch information
sliemeobn committed Aug 28, 2024
1 parent fcaa097 commit e3c900f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/hummingbird-project/hummingbird.git", from: "2.0.0-rc.1"),
.package(url: "https://github.com/sliemeobn/elementary.git", .upToNextMajor(from: "0.1.2")),
.package(url: "https://github.com/hummingbird-project/hummingbird.git", from: "2.0.0-rc.5"),
.package(url: "https://github.com/sliemeobn/elementary.git", .upToNextMajor(from: "0.2.0")),
],
targets: [
.target(
Expand Down
7 changes: 4 additions & 3 deletions Sources/HummingbirdElementary/HTMLResponse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public struct HTMLResponse<Content: HTML & Sendable>: Sendable {
extension HTMLResponse: ResponseGenerator {
struct StreamWriter: HTMLStreamWriter {
let allocator: ByteBufferAllocator
let writer: any ResponseBodyWriter
var writer: any ResponseBodyWriter

func write(_ bytes: ArraySlice<UInt8>) async throws {
mutating func write(_ bytes: ArraySlice<UInt8>) async throws {
try await self.writer.write(self.allocator.buffer(bytes: bytes))
}
}
Expand All @@ -51,7 +51,8 @@ extension HTMLResponse: ResponseGenerator {
status: .ok,
headers: [.contentType: "text/html; charset=utf-8"],
body: .init { [self] writer in
try await self.content.render(into: StreamWriter(allocator: context.allocator, writer: writer), chunkSize: self.chunkSize)
try await self.content.render(into: StreamWriter(allocator: ByteBufferAllocator(), writer: writer), chunkSize: self.chunkSize)
try await writer.finish(nil)
}
)
}
Expand Down

0 comments on commit e3c900f

Please sign in to comment.