diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-02-23 15:58:11 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-02-23 15:58:11 +0100 |
commit | 1fc0e6bcfee7b8edfd684f016fb85f27e6842611 (patch) | |
tree | c5e1c32618b7439138cac682558324842e88333e | |
parent | 8098010209fe4f589781eb9b9e117750ffba63b1 (diff) | |
download | gnu-taler-payment-for-woocommerce-1fc0e6bcfee7b8edfd684f016fb85f27e6842611.tar.gz gnu-taler-payment-for-woocommerce-1fc0e6bcfee7b8edfd684f016fb85f27e6842611.tar.bz2 gnu-taler-payment-for-woocommerce-1fc0e6bcfee7b8edfd684f016fb85f27e6842611.zip |
fix HTTP header construction
-rw-r--r-- | class-wc-gnutaler-gateway.php | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/class-wc-gnutaler-gateway.php b/class-wc-gnutaler-gateway.php index 1305479..5d859c1 100644 --- a/class-wc-gnutaler-gateway.php +++ b/class-wc-gnutaler-gateway.php @@ -184,7 +184,6 @@ function gnutaler_init_gateway_class() { 20, 4 ); - $this->debug( "GNU Taler payment gateway class constructed" ); } @@ -426,8 +425,6 @@ function gnutaler_init_gateway_class() { * @return array The return array will either have the successful return value or a detailed error message. */ private function call_api( $method, $url, $body ): array { - $this->warning( "Running " . $method . " on " . $url ); - $apikey = $this->get_option( 'GNU_Taler_Backend_API_Key' ); $args = array( 'timeout' => 30, // In seconds. @@ -436,14 +433,14 @@ function gnutaler_init_gateway_class() { 'user-agent' => '', // Minimize information leakage. 'blocking' => true, // We do nothing without it. 'headers' => array( - 'Authorization: Bearer ' . $apikey, + 'Authorization' => 'Bearer ' . $apikey, ), 'decompress' => true, 'limit_response_size' => 1024 * 1024, // More than enough. ); if ( $body ) { $args['body'] = wp_json_encode( $body, JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES, 16 ); - $args['headers'][] = 'Content-type: application/json'; + $args['headers']['Content-type'] = 'application/json'; $args['compress'] = true; } $this->debug( 'Issuing HTTP ' . $method . ' request to ' . $url . ' with options ' . wp_json_encode( $args ) . ' and body ' . $body ); |