Skip to content

Commit 467ebc3

Browse files
author
Edwin Westerhoud
committed
Fixed incorrect content type in fopen client that caused the original compression to fail.
1 parent 3f0cc81 commit 467ebc3

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/class-tiny-compress-fopen.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,12 @@ private function parse_headers( $headers ) {
193193
return $res;
194194
}
195195

196-
private function request_options( $method, $body = null ) {
196+
private function request_options( $method, $body = null, $content_type = 'image/png' ) {
197197
return array(
198198
'http' => array(
199199
'method' => $method,
200200
'header' => array(
201-
'Content-type: image/png',
201+
'Content-type: ' . $content_type,
202202
'Authorization: Basic ' . base64_encode( 'api:' . $this->api_key ),
203203
'User-Agent: ' . self::identifier(),
204204
),
@@ -226,8 +226,7 @@ private function output_request_options( $resize_opts, $preserve_opts ) {
226226
}
227227

228228
if ( $resize_opts || $preserve_opts ) {
229-
$options['http']['header'][] = 'Content-Type: application/json';
230-
return $this->request_options( 'GET', json_encode( $body ) );
229+
return $this->request_options( 'GET', json_encode( $body ), 'application/json' );
231230
} else {
232231
return $this->request_options( 'GET', null );
233232
}

0 commit comments

Comments
 (0)