tinify/tinify-php

tinify API always requires application/json

Cyken-Zeraux opened this issue · 1 comments

Tinify master and V1.1 will always result in error:

PHP Fatal error: Uncaught exception 'Tinify\ClientException' wi
th message 'Please use application/json as Content-Type (HTTP 41
5/UnsupportedMediaType)' in C:\php-tiny\vendor
\tinify\tinify\lib\Tinify\Exception.php:18

require_once("vendor/autoload.php");
\Tinify\setKey("dev key"); 
$source = \Tinify\fromFile('C:\file.jpg');
$source->toFile('C:\target_file.jpg');

Thanks, this has been fixed in be7c5aa, released in version 1.1.1. The problem was a body was always sent which causes a POST request, even if it was empty.