diff --git a/Sources/HummingbirdTesting/RouterTestFramework.swift b/Sources/HummingbirdTesting/RouterTestFramework.swift index 2e40a88b4..8b64e033c 100644 --- a/Sources/HummingbirdTesting/RouterTestFramework.swift +++ b/Sources/HummingbirdTesting/RouterTestFramework.swift @@ -97,6 +97,10 @@ struct RouterTestFramework: ApplicationTestFramework w func executeRequest(uri: String, method: HTTPRequest.Method, headers: HTTPFields, body: ByteBuffer?) async throws -> TestResponse { return try await withThrowingTaskGroup(of: TestResponse.self) { group in + var headers = headers + if let contentLength = body.map(\.readableBytes) { + headers[.contentLength] = String(describing: contentLength) + } let (stream, source) = RequestBody.makeStream() let request = Request( head: .init(method: method, scheme: "http", authority: "localhost", path: uri, headerFields: headers),