File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ public enum HttpResponseBody {
2626 case html( String )
2727 case htmlBody( String )
2828 case text( String )
29- case data( Data )
29+ case data( Data , contentType : String ? = nil )
3030 case custom( Any , ( Any ) throws -> String )
3131
3232 func content( ) -> ( Int , ( ( HttpResponseBodyWriter ) throws -> Void ) ? ) {
@@ -56,7 +56,7 @@ public enum HttpResponseBody {
5656 return ( data. count, {
5757 try $0. write ( data)
5858 } )
59- case . data( let data) :
59+ case . data( let data, _ ) :
6060 return ( data. count, {
6161 try $0. write ( data)
6262 } )
@@ -132,6 +132,7 @@ public enum HttpResponse {
132132 switch body {
133133 case . json: headers [ " Content-Type " ] = " application/json "
134134 case . html: headers [ " Content-Type " ] = " text/html "
135+ case . data( _, let contentType) : headers [ " Content-Type " ] = contentType
135136 default : break
136137 }
137138 case . movedPermanently( let location) :
You can’t perform that action at this time.
0 commit comments