From 2e529123763574f2eb8627001609a55c19ade252 Mon Sep 17 00:00:00 2001 From: Nick Daugherty <ndaugherty987@gmail.com> Date: Wed, 10 Apr 2013 10:22:16 -0600 Subject: [PATCH] Fix how Authorization header is added --- class-wp-codebird.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/class-wp-codebird.php b/class-wp-codebird.php index a933371..4cc2d71 100644 --- a/class-wp-codebird.php +++ b/class-wp-codebird.php @@ -77,7 +77,10 @@ class WP_Codebird extends Codebird { $headers = array(); if ( isset( $authorization ) ) { - $headers = array( $authorization, 'Expect:' ); + $headers = array( + 'Authorization' => str_replace( 'Authorization:', '', $authorization ), + 'Expect:' => null + ); } $remote_params = array( @@ -106,9 +109,8 @@ class WP_Codebird extends Codebird { $remote_params['headers']['authorization'] = $bearer; } else { // If this is a standard OAuth GET request, add on the authorization header - // Must be added here because $app_only_auth affects what the header will be if ( 'GET' == $httpmethod ) - $remote_params['headers'][] = $authorization; + $remote_params['headers']['Authorization'] = str_replace( 'Authorization:', '', $authorization ); } if ( 'GET' == $httpmethod ) { @@ -185,7 +187,7 @@ class WP_Codebird extends Codebird { if ( 200 == $httpstatus ) self::setBearerToken( $reply->access_token ); } else { - $reply['httpstatus'] = $httpstatus; + $reply['httpstatus'] = $httpstatus;å if ( 200 == $httpstatus ) self::setBearerToken( $reply['access_token'] ); @@ -243,4 +245,4 @@ class WP_Codebird extends Codebird { } return $parsed; } -} \ No newline at end of file +} -- GitLab