You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/VaporElementary/HTMLResponse.swift
+29-4Lines changed: 29 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -14,11 +14,14 @@ import Vapor
14
14
/// }
15
15
/// }
16
16
/// }
17
+
///
18
+
/// NOTE: For non-sendable HTML values, the resulting response body can only be written once.
19
+
/// Multiple writes will result in a runtime error.
17
20
/// ```
18
21
publicstructHTMLResponse:Sendable{
19
22
// NOTE: The Sendable requirement on Content can probably be removed in Swift 6 using a sending parameter, and some fancy ~Copyable @unchecked Sendable box type.
20
23
// We only need to pass the HTML value to the response generator body closure
21
-
privateletcontent:anyHTML&Sendable
24
+
privateletvalue:_SendableAnyHTMLBox
22
25
23
26
/// The number of bytes to write to the response body at a time.
24
27
///
@@ -45,13 +48,30 @@ public struct HTMLResponse: Sendable {
45
48
/// - additionalHeaders: Additional headers to be merged with predefined headers.
46
49
/// - content: The `HTML` content to render in the response.
0 commit comments