Skip to content

Commit

Permalink
docs: add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Nov 19, 2023
1 parent 4c55a28 commit 989167f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
2 changes: 2 additions & 0 deletions user_guide_src/source/changelogs/v4.5.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
***************
Expand Down
16 changes: 15 additions & 1 deletion user_guide_src/source/incoming/message.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions user_guide_src/source/incoming/message/011.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?php

$message->addHeader('Set-Cookie', 'logged_in=no; Path=/');
$message->addHeader('Set-Cookie', 'sessid=123456; Path=/');

0 comments on commit 989167f

Please sign in to comment.