Skip to content

Commit

Permalink
hb2 compiles successfully
Browse files Browse the repository at this point in the history
  • Loading branch information
photovirus committed Jul 6, 2024
1 parent a0d95e6 commit 0db0821
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions frameworks/Swift/hummingbird2/src/Sources/server/main.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import Foundation
import Hummingbird
import HummingbirdCore
import Logging
import NIOCore

Expand All @@ -7,18 +9,23 @@ struct Object: ResponseEncodable {
}

struct TechFrameworkRequestContext: RequestContext {

static let jsonEncoder = JSONEncoder()
static let jsonDecoder = JSONDecoder()

var coreContext: Hummingbird.CoreRequestContext
var coreContext: Hummingbird.CoreRequestContextStorage

// Use a global JSON Encoder
var responseEncoder: JSONEncoder { Self.jsonEncoder }
// Use a global JSON Decoder
var requestDecoder: JSONDecoder { Self.jsonDecoder }

init(source: Hummingbird.ApplicationRequestContextSource) {
self.coreContext = CoreRequestContextStorage(source: ApplicationRequestContextSource(channel: source.channel, logger: source.logger))
}

init(channel: any Channel, logger: Logger) {
self.coreContext = .init(allocator: channel.allocator, logger: logger)
self.coreContext = CoreRequestContextStorage(source: ApplicationRequestContextSource(channel: channel, logger: logger))
}
}

Expand Down

0 comments on commit 0db0821

Please sign in to comment.