@@ -9,9 +9,10 @@ class Response
99 * This code is taken from EE_Output::_display() with some modifications
1010 *
1111 * @param int $status
12+ * @param array $headers
1213 * @return Illuminate\Http\Response
1314 */
14- public function fromOutput ($ status = 200 )
15+ public function fromOutput ($ status = 200 , $ headers = [] )
1516 {
1617 $ output = ee ()->output ->final_output ;
1718 $ response = ee ('Response ' ) ?: new \ExpressionEngine \Core \Response ;
@@ -36,7 +37,6 @@ public function fromOutput($status = 200)
3637
3738 // Content Type Headers
3839 // Also need to do some extra work for feeds
39-
4040 switch (ee ()->output ->out_type ) {
4141 case 'webpage ' :
4242 if (! $ response ->hasHeader ('Content-Type ' )) {
@@ -258,7 +258,7 @@ public function fromOutput($status = 200)
258258
259259 // Transform headers that have already been set on the request
260260 // to the correct format ["header_name" => "value"]
261- $ headers = array_reduce (headers_list (), function ($ carry , $ header ) use ($ exclude , $ duplicates ) {
261+ $ headers = array_merge ( $ headers , array_reduce (headers_list (), function ($ carry , $ header ) use ($ exclude , $ duplicates ) {
262262 $ header = $ this ->parseHeader ($ header );
263263
264264 if (! in_array (strtolower ($ header ->name ), $ exclude )) {
@@ -271,7 +271,7 @@ public function fromOutput($status = 200)
271271 }
272272
273273 return $ carry ;
274- }, []);
274+ }, [])) ;
275275
276276 // Transform and set headers that have been assigned to the Output class
277277 // but not yet set on the request to be ["header_name" => "value"]
0 commit comments