We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
data
HttpResponseBody
1 parent eafa10b commit 64c8382Copy full SHA for 64c8382
Sources/HttpResponse.swift
@@ -25,6 +25,7 @@ public enum HttpResponseBody {
25
case json(AnyObject)
26
case html(String)
27
case text(String)
28
+ case data(Data)
29
case custom(Any, (Any) throws -> String)
30
31
func content() -> (Int, ((HttpResponseBodyWriter) throws -> Void)?) {
@@ -56,6 +57,10 @@ public enum HttpResponseBody {
56
57
return (data.count, {
58
try $0.write(data)
59
})
60
+ case .data(let data):
61
+ return (data.count, {
62
+ try $0.write(data)
63
+ })
64
case .custom(let object, let closure):
65
let serialised = try closure(object)
66
let data = [UInt8](serialised.utf8)
0 commit comments