lithium\action\Response::headers()

public method
This method will be removed in a future version. Note that the parent `header()` wil continue to exist.

Expands on \net\http\Message::headers() with some magic conversions for shorthand headers.

Parameters

  • string|array $key
  • mixed $value
  • boolean $replace

Returns

mixed

Source

	public function headers($key = null, $value = null, $replace = true) {
		if ($key === 'download' || $key === 'Download') {
			$message  = "Shorthand header `Download` with `<FILENAME>` has been deprecated ";
			$message .= "because it's too magic. Please use `Content-Disposition` ";
			$message .= "with `attachment; filename=\"<FILENAME>\"` instead.";
			trigger_error($message, E_USER_DEPRECATED);

			$key = 'Content-Disposition';
			$value = 'attachment; filename="' . $value . '"';
		}
		return parent::headers($key, $value, $replace);
	}