jenkins-bot has submitted this change and it was merged.

Change subject: Add WebResponse::getHeader()
......................................................................


Add WebResponse::getHeader()

Equivalent to FauxResponse::getHeader()
Also change case of FauxResponse::getHeader.

Change-Id: I569b2ebbcd166f5d0a5a5f2dfa913a6aa49e13f4
---
M includes/WebResponse.php
1 file changed, 17 insertions(+), 1 deletion(-)

Approvals:
  Chad: Looks good to me, approved
  MaxSem: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/WebResponse.php b/includes/WebResponse.php
index ad9f4e6..d39f884 100644
--- a/includes/WebResponse.php
+++ b/includes/WebResponse.php
@@ -38,6 +38,22 @@
        }
 
        /**
+        * Get a response header
+        * @param string $key The name of the header to get (case insensitive).
+        * @return string|null The header value (if set); null otherwise.
+        * @since 1.25
+        */
+       public function getHeader( $key ) {
+               foreach ( headers_list() as $header ) {
+                       list( $name, $val ) = explode( ':', $header, 2 );
+                       if ( !strcasecmp( $name, $key ) ) {
+                               return trim( $val );
+                       }
+               }
+               return null;
+       }
+
+       /**
         * Set the browser cookie
         * @param string $name Name of cookie
         * @param string $value Value to give cookie
@@ -150,7 +166,7 @@
         * @param string $key The name of the header to get (case insensitive).
         * @return string
         */
-       public function getheader( $key ) {
+       public function getHeader( $key ) {
                $key = strtoupper( $key );
 
                if ( isset( $this->headers[$key] ) ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/171872
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I569b2ebbcd166f5d0a5a5f2dfa913a6aa49e13f4
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to