Ori.livneh has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/171886

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

Add WebResponse::getHeader()

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

Change-Id: I569b2ebbcd166f5d0a5a5f2dfa913a6aa49e13f4
(cherry picked from commit 67e9b8e3946389c2797fa41eccbd439aab7e211d)
---
M includes/WebResponse.php
1 file changed, 17 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/86/171886/1

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/171886
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I569b2ebbcd166f5d0a5a5f2dfa913a6aa49e13f4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.25wmf7
Gerrit-Owner: Ori.livneh <[email protected]>

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

Reply via email to