From 989167f689d074f3edd4169aab4785dd7e165476 Mon Sep 17 00:00:00 2001 From: kenjis Date: Mon, 20 Nov 2023 06:38:01 +0900 Subject: [PATCH] docs: add docs --- user_guide_src/source/changelogs/v4.5.0.rst | 2 ++ user_guide_src/source/incoming/message.rst | 16 +++++++++++++++- user_guide_src/source/incoming/message/011.php | 4 ++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 user_guide_src/source/incoming/message/011.php diff --git a/user_guide_src/source/changelogs/v4.5.0.rst b/user_guide_src/source/changelogs/v4.5.0.rst index e4d72f5a1b08..39b9b2264e3f 100644 --- a/user_guide_src/source/changelogs/v4.5.0.rst +++ b/user_guide_src/source/changelogs/v4.5.0.rst @@ -268,6 +268,8 @@ Others usage in your view files, which was supported by CodeIgniter 3. - **CSP:** Added ``ContentSecurityPolicy::clearDirective()`` method to clear existing CSP directives. See :ref:`csp-clear-directives`. +- **HTTP:** Added ``Message::addHeader()`` method to add another header with + the same name. See :php:meth:`CodeIgniter\\HTTP\\Message::addHeader()`. Message Changes *************** diff --git a/user_guide_src/source/incoming/message.rst b/user_guide_src/source/incoming/message.rst index 2609c0b5fb07..5ea83f1d2bd2 100644 --- a/user_guide_src/source/incoming/message.rst +++ b/user_guide_src/source/incoming/message.rst @@ -7,7 +7,7 @@ requests and responses, including the message body, protocol version, utilities the headers, and methods for handling content negotiation. This class is the parent class that both the :doc:`Request Class <../incoming/request>` and the -:doc:`Response Class <../outgoing/response>` extend from. +:doc:`Response Class <../outgoing/response>` extend from, and it is not used directly. *************** Class Reference @@ -146,6 +146,20 @@ Class Reference .. literalinclude:: message/009.php + .. php:method:: addHeader($name, $value) + + .. versionadded:: 4.5.0 + + :param string $name: The name of the header to add. + :param string $value: The value of the header. + :returns: The current message instance + :rtype: CodeIgniter\\HTTP\\Message + + Adds a header (not a header value) with the same name. + Use this only when you set multiple headers with the same name, + + .. literalinclude:: message/011.php + .. php:method:: getProtocolVersion() :returns: The current HTTP protocol version diff --git a/user_guide_src/source/incoming/message/011.php b/user_guide_src/source/incoming/message/011.php new file mode 100644 index 000000000000..b5b2c323c513 --- /dev/null +++ b/user_guide_src/source/incoming/message/011.php @@ -0,0 +1,4 @@ +addHeader('Set-Cookie', 'logged_in=no; Path=/'); +$message->addHeader('Set-Cookie', 'sessid=123456; Path=/');