Mangopay / mangopay2-php-sdk

PHP SDK for MANGOPAY
https://packagist.org/packages/mangopay/php-sdk-v2
MIT License
123 stars 134 forks source link

user-agent header invalid format #428

Closed mathroc closed 4 years ago

mathroc commented 4 years ago

Hi,

I’ve implemented a HttpClient for MangoPay by extending MangoPay\Libraries\HttpBase that uses the Symfony HttpClient (in order to have http request log in the profiler etc.).

I’ve upgraded to 3.1.2 and found a BC break and the user agent header format changed in #406. It no longer uncludes the "user-agent: " prefix, it went from "User-Agent: MANGOPAY PHP SDK/x.x.x" to "MangoPay V2 SDK PHPx.x.x". It broke my implementation because the Symfony HttpClient validates the headers before making the request

I don’t really understand why this changes was made. @catacraciun do you mind telling how that header is supposed to be handled in a custom HttpClient ?

I’ll make a quick fix by searching for ^MangoPay V2 SDK PHP and prepending "User-agent: " there but it seems odd

mangomaxoasis commented 4 years ago

Hi @mathroc We implemented the change because of API standards. indeed, we should keep User-Agent a fix is underway Max

catacraciun commented 4 years ago

Hi @mathroc , Sure, we'll change the user agent as suggested and do a release to fix this ASAP.

mangomaxoasis commented 4 years ago

Hi @mathroc This is the release https://github.com/Mangopay/mangopay2-php-sdk/releases/tag/3.1.3