11//
22// OutgoingResponse.swift
3- //
3+ //
44//
55// Created by Andrew Barba on 1/13/22.
66//
77
8- public final class OutgoingResponse {
8+ public actor OutgoingResponse {
99
1010 internal private( set) var response : Fastly . Response
1111
@@ -222,7 +222,8 @@ extension OutgoingResponse {
222222extension OutgoingResponse {
223223
224224 @discardableResult
225- public func write< T> ( _ value: T , encoder: JSONEncoder = . init( ) ) async throws -> Self where T: Encodable & Sendable {
225+ public func write< T> ( _ value: T , encoder: JSONEncoder = . init( ) ) async throws -> Self
226+ where T: Encodable & Sendable {
226227 try await sendAndStream ( )
227228 try await body. write ( value, encoder: encoder)
228229 return self
@@ -295,7 +296,7 @@ extension OutgoingResponse {
295296
296297private let invalidProxyHeaders : Set < String > = [
297298 HTTPHeader . altSvc. rawValue,
298- HTTPHeader . transferEncoding. rawValue
299+ HTTPHeader . transferEncoding. rawValue,
299300]
300301
301302// MARK: - CORS
@@ -313,9 +314,11 @@ extension OutgoingResponse {
313314 ) -> Self {
314315 headers [ . accessControlAllowOrigin] = origin
315316 headers [ . accessControlAllowMethods] = methods. map { $0. rawValue } . joined ( separator: " , " )
316- headers [ . accessControlAllowHeaders] = allowHeaders? . map { $0. stringValue } . joined ( separator: " , " ) ?? " * "
317+ headers [ . accessControlAllowHeaders] =
318+ allowHeaders? . map { $0. stringValue } . joined ( separator: " , " ) ?? " * "
317319 headers [ . accessControlAllowCredentials] = allowCredentials? . description
318- headers [ . accessControlExposeHeaders] = exposeHeaders? . map { $0. stringValue } . joined ( separator: " , " )
320+ headers [ . accessControlExposeHeaders] = exposeHeaders? . map { $0. stringValue } . joined (
321+ separator: " , " )
319322 headers [ . accessControlMaxAge] = String ( maxAge)
320323 return self
321324 }
@@ -338,7 +341,8 @@ extension OutgoingResponse {
338341
339342 @discardableResult
340343 public func upgradeToHTTP3( maxAge: Int = 86400 ) -> Self {
341- headers [ . altSvc] = #"h3=":443";ma= \#( maxAge) ,h3-29=":443";ma= \#( maxAge) ,h3-27=":443";ma= \#( maxAge) "#
344+ headers [ . altSvc] =
345+ #"h3=":443";ma= \#( maxAge) ,h3-29=":443";ma= \#( maxAge) ,h3-27=":443";ma= \#( maxAge) "#
342346 return self
343347 }
344348}
@@ -412,8 +416,10 @@ extension OutgoingResponse {
412416 _ value: String ,
413417 _ options: [ CookieOption ]
414418 ) -> Self {
415- let encodedName = name. addingPercentEncoding ( withAllowedCharacters: . javascriptURLAllowed) ?? name
416- let encodedValue = value. addingPercentEncoding ( withAllowedCharacters: . javascriptURLAllowed) ?? value
419+ let encodedName =
420+ name. addingPercentEncoding ( withAllowedCharacters: . javascriptURLAllowed) ?? name
421+ let encodedValue =
422+ value. addingPercentEncoding ( withAllowedCharacters: . javascriptURLAllowed) ?? value
417423 let parts = [ " \( encodedName) = \( encodedValue) " ] + options. map ( \. value)
418424 let header = parts. joined ( separator: " ; " )
419425 headers. append ( . setCookie, header)
0 commit comments