Avoid setting multiple Content-Type headers.
authorMark A. Hershberger <mah@everybody.org>
Wed, 28 Mar 2012 18:53:41 +0000 (14:53 -0400)
committerMark A. Hershberger <mah@everybody.org>
Wed, 28 Mar 2012 18:58:44 +0000 (14:58 -0400)
Necessary for JSON-RPC where Content-Type has to be set to
application/json on POST.

Change-Id: I0d974c98d914a22d0150a198a9f630206bb01d64

includes/HttpFunctions.php

index 8dd6525..a1d2e59 100644 (file)
@@ -800,7 +800,9 @@ class PhpHttpRequest extends MWHttpRequest {
                if ( $this->method == 'POST' ) {
                        // Required for HTTP 1.0 POSTs
                        $this->reqHeaders['Content-Length'] = strlen( $this->postData );
-                       $this->reqHeaders['Content-type'] = "application/x-www-form-urlencoded";
+                       if( !isset( $this->reqHeaders['Content-Type'] ) ) {
+                               $this->reqHeaders['Content-Type'] = "application/x-www-form-urlencoded";
+                       }
                }
 
                $options = array();