Browse Source

dev 2020-11

Max F 5 years ago
parent
commit
dcbafd7e14
1 changed files with 8 additions and 2 deletions
  1. 8 2
      src/Http/Response.php

+ 8 - 2
src/Http/Response.php

@@ -183,7 +183,13 @@ class Response
 		if (! is_string($json) || ! in_array(substr($json, 0, 1), ['"', "'", '[', '{'])) {
 			$json = json_encode($json);
 		}
-		return $this->download($json, $download_file_name, $status, $content_type);
+		//return $this->download($json, $download_file_name, $status, $content_type);
+		
+		$this->download_file_name = $download_file_name;
+
+		return $this->setBody($json)
+				->setContentType($content_type)
+				->setStatus($status);
 	}
 
 	public function csv(array $rows, $download_file_name=null, $status=200, $content_type='text/csv; charset=utf8')
@@ -207,7 +213,7 @@ class Response
 		$this->download_file_path = $file_path;
 		$this->download_file_name = empty($download_file_name) ? basename($file_path) : $download_file_name;
 
-		return $this->setBody($body)
+		return $this->setBody('')
 				->setContentType($content_type)
 				->setStatus($status);
 	}