DigitalOceanPHP / Client

DigitalOcean API v2 client for PHP
MIT License
709 stars 205 forks source link

Please fix ResponseMediator CONTENT_TYPE_HEADER #261

Closed alikmanukian closed 3 years ago

alikmanukian commented 3 years ago

Hey guys. Please fix CONTENT_TYPE_HEADER value from 'Content-type' to 'content-type'. ResponseMediator::getContent throws Exception because $response['headers'] = ['content-type' => 'application/json'] instead of ['Content-Type' => 'application/json']. Few days ago everything was working good. Today it has broken.

Thanks.

GrahamCampbell commented 3 years ago

I don't follow. The code always has had Content-Type, and still does. The addition of that constant was purely refactoring: https://github.com/DigitalOceanPHP/Client/commit/a3742c6e2185d3c217573633db282040c62f1d73#diff-0e3b8d8b7fa64bd9ae52d4a7e79013759c72056b0fd5100f88e179e1df1e0c2f.

GrahamCampbell commented 3 years ago

Please describe what it is that is broken, and we can investigate, otherwise, we have nothing to go on, here.

alikmanukian commented 3 years ago

Please try to create domain. In response I have started to get 'content-type' instead 'Content-Type'.

$api = app()->make(\GrahamCampbell\DigitalOcean\DigitalOceanManager::class);
$api->domain()->create('example.com', '1.1.1.1');

You will get RuntimeException. with message The content type was not application/json.

GrahamCampbell commented 3 years ago

Can you run composer show?

alikmanukian commented 3 years ago
asm89/stack-cors                     v2.0.2    Cross-origin resource sharin...
aws/aws-sdk-php                      3.171.10  AWS SDK for PHP - Use Amazon...
bacon/bacon-qr-code                  2.0.3     BaconQrCode is a QR code gen...
brick/math                           0.9.1     Arbitrary-precision arithmet...
clue/stream-filter                   v1.5.0    A simple and modern approach...
composer/package-versions-deprecated 1.11.99.1 Composer plugin that provide...
dasprid/enum                         1.0.3     PHP 7.1 enum implementation
dnoegel/php-xdg-base-dir             v0.1.1    implementation of xdg base d...
doctrine/inflector                   2.0.3     PHP Doctrine Inflector is a ...
doctrine/instantiator                1.4.0     A small, lightweight utility...
doctrine/lexer                       1.2.1     PHP Doctrine Lexer parser li...
dragonmantank/cron-expression        v3.1.0    CRON for PHP: Calculate the ...
egulias/email-validator              2.1.25    A library for validating ema...
facade/flare-client-php              1.3.7     Send PHP errors to Flare
facade/ignition                      2.5.8     A beautiful error page for L...
facade/ignition-contracts            1.0.2     Solution contracts for Ignition
fakerphp/faker                       v1.13.0   Faker is a PHP library that ...
fideloper/proxy                      4.4.1     Set trusted proxies for Laravel
filp/whoops                          2.9.1     php error handling for cool ...
fruitcake/laravel-cors               v2.0.3    Adds CORS (Cross-Origin Reso...
graham-campbell/digitalocean         v8.0.0    DigitalOcean Is A DigitalOce...
graham-campbell/manager              v4.6.0    Manager Provides Some Manage...
graham-campbell/result-type          v1.0.1    An Implementation Of The Res...
guzzlehttp/guzzle                    7.2.0     Guzzle is a PHP HTTP client ...
guzzlehttp/promises                  1.4.0     Guzzle promises library
guzzlehttp/psr7                      1.7.0     PSR-7 message implementation...
hamcrest/hamcrest-php                v2.0.1    This is the PHP port of Hamc...
http-interop/http-factory-guzzle     1.0.0     An HTTP Factory using Guzzle...
inertiajs/inertia-laravel            v0.2.15   The Laravel adapter for Iner...
jaybizzle/crawler-detect             v1.2.103  CrawlerDetect is a PHP class...
jean85/pretty-package-versions       1.5.1     A wrapper for ocramius/packa...
jenssegers/agent                     v2.6.4    Desktop/mobile user agent pa...
laravel/fortify                      v1.7.2    Backend controllers and scaf...
laravel/framework                    v8.20.1   The Laravel Framework.
laravel/jetstream                    v1.6.5    Tailwind scaffolding for the...
laravel/sail                         v0.0.5    Docker files for running a b...
laravel/sanctum                      v2.8.2    Laravel Sanctum provides a f...
laravel/tinker                       v2.5.0    Powerful REPL for the Larave...
league/commonmark                    1.5.7     Highly-extensible PHP Markdo...
league/flysystem                     1.1.3     Filesystem abstraction: Many...
league/flysystem-aws-s3-v3           1.0.29    Flysystem adapter for the AW...
league/mime-type-detection           1.5.1     Mime-type detection for Flys...
mobiledetect/mobiledetectlib         2.8.34    Mobile_Detect is a lightweig...
mockery/mockery                      1.4.2     Mockery is a simple yet flex...
monolog/monolog                      2.2.0     Sends your logs to files, so...
mtdowling/jmespath.php               2.6.0     Declaratively specify how to...
myclabs/deep-copy                    1.10.2    Create deep copies (clones) ...
nesbot/carbon                        2.43.0    An API extension for DateTim...
nikic/php-parser                     v4.10.4   A PHP parser written in PHP
nunomaduro/collision                 v5.1.0    Cli error handling for conso...
opis/closure                         3.6.1     A library that can be used t...
paragonie/constant_time_encoding     v2.4.0    Constant-time Implementation...
phar-io/manifest                     2.0.1     Component for reading phar.i...
phar-io/version                      3.0.4     Library for handling version...
php-http/client-common               2.3.0     Common HTTP Client implement...
php-http/discovery                   1.13.0    Finds installed HTTPlug impl...
php-http/httplug                     2.2.0     HTTPlug, the HTTP client abs...
php-http/message                     1.10.0    HTTP Message related tools
php-http/message-factory             v1.0.2    Factory interfaces for PSR-7...
php-http/promise                     1.1.0     Promise used for asynchronou...
phpdocumentor/reflection-common      2.2.0     Common reflection classes us...
phpdocumentor/reflection-docblock    5.2.2     With this component, a libra...
phpdocumentor/type-resolver          1.4.0     A PSR-5 based resolver of Cl...
phpoption/phpoption                  1.7.5     Option Type for PHP
phpspec/prophecy                     1.12.2    Highly opinionated mocking f...
phpunit/php-code-coverage            9.2.5     Library that provides collec...
phpunit/php-file-iterator            3.0.5     FilterIterator implementatio...
phpunit/php-invoker                  3.1.1     Invoke callables with a timeout
phpunit/php-text-template            2.0.4     Simple template engine.
phpunit/php-timer                    5.0.3     Utility class for timing
phpunit/phpunit                      9.5.0     The PHP Unit Testing framework.
pragmarx/google2fa                   8.0.0     A One Time Password Authenti...
psr/container                        1.0.0     Common Container Interface (...
psr/event-dispatcher                 1.0.0     Standard interfaces for even...
psr/http-client                      1.0.1     Common interface for HTTP cl...
psr/http-factory                     1.0.1     Common interfaces for PSR-7 ...
psr/http-message                     1.0.1     Common interface for HTTP me...
psr/log                              1.1.3     Common interface for logging...
psr/simple-cache                     1.0.1     Common interfaces for simple...
psy/psysh                            v0.10.5   An interactive shell for mod...
ralouphie/getallheaders              3.0.3     A polyfill for getallheaders.
ramsey/collection                    1.1.1     A PHP 7.2+ library for repre...
ramsey/uuid                          4.1.1     A PHP library for generating...
sebastian/cli-parser                 1.0.1     Library for parsing CLI options
sebastian/code-unit                  1.0.8     Collection of value objects ...
sebastian/code-unit-reverse-lookup   2.0.3     Looks up which function or m...
sebastian/comparator                 4.0.6     Provides the functionality t...
sebastian/complexity                 2.0.2     Library for calculating the ...
sebastian/diff                       4.0.4     Diff implementation
sebastian/environment                5.1.3     Provides functionality to ha...
sebastian/exporter                   4.0.3     Provides the functionality t...
sebastian/global-state               5.0.2     Snapshotting of global state
sebastian/lines-of-code              1.0.3     Library for counting the lin...
sebastian/object-enumerator          4.0.4     Traverses array structures a...
sebastian/object-reflector           2.0.4     Allows reflection of object ...
sebastian/recursion-context          4.0.4     Provides functionality to re...
sebastian/resource-operations        3.0.3     Provides a list of PHP built...
sebastian/type                       2.3.1     Collection of value objects ...
sebastian/version                    3.0.2     Library that helps with mana...
sentry/sdk                           3.1.0     This is a metapackage shippi...
sentry/sentry                        3.1.1     A PHP SDK for Sentry (http:/...
sentry/sentry-laravel                2.3.1     Laravel SDK for Sentry (http...
swiftmailer/swiftmailer              v6.2.4    Swiftmailer, free feature-ri...
symfony/console                      v5.2.1    Symfony Console Component
symfony/css-selector                 v5.2.1    Symfony CssSelector Component
symfony/deprecation-contracts        v2.2.0    A generic function and conve...
symfony/error-handler                v5.2.1    Symfony ErrorHandler Component
symfony/event-dispatcher             v5.2.1    Symfony EventDispatcher Comp...
symfony/event-dispatcher-contracts   v2.2.0    Generic abstractions related...
symfony/finder                       v5.2.1    Symfony Finder Component
symfony/http-client                  v5.2.1    Symfony HttpClient component
symfony/http-client-contracts        v2.3.1    Generic abstractions related...
symfony/http-foundation              v5.2.1    Symfony HttpFoundation Compo...
symfony/http-kernel                  v5.2.1    Symfony HttpKernel Component
symfony/mime                         v5.2.1    A library to manipulate MIME...
symfony/options-resolver             v5.2.1    Symfony OptionsResolver Comp...
symfony/polyfill-ctype               v1.20.0   Symfony polyfill for ctype f...
symfony/polyfill-iconv               v1.20.0   Symfony polyfill for the Ico...
symfony/polyfill-intl-grapheme       v1.20.0   Symfony polyfill for intl's ...
symfony/polyfill-intl-idn            v1.20.0   Symfony polyfill for intl's ...
symfony/polyfill-intl-normalizer     v1.20.0   Symfony polyfill for intl's ...
symfony/polyfill-mbstring            v1.20.0   Symfony polyfill for the Mbs...
symfony/polyfill-php72               v1.20.0   Symfony polyfill backporting...
symfony/polyfill-php73               v1.20.0   Symfony polyfill backporting...
symfony/polyfill-php80               v1.20.0   Symfony polyfill backporting...
symfony/polyfill-uuid                v1.20.0   Symfony polyfill for uuid fu...
symfony/process                      v5.2.1    Symfony Process Component
symfony/routing                      v5.2.1    Symfony Routing Component
symfony/service-contracts            v2.2.0    Generic abstractions related...
symfony/string                       v5.2.1    Symfony String component
symfony/translation                  v5.2.1    Symfony Translation Component
symfony/translation-contracts        v2.3.0    Generic abstractions related...
symfony/var-dumper                   v5.2.1    Symfony mechanism for explor...
theseer/tokenizer                    1.2.0     A small library for converti...
tightenco/ziggy                      0.9.4     Generates a Blade directive ...
tijsverkoyen/css-to-inline-styles    2.2.3     CssToInlineStyles is a class...
toin0u/digitalocean-v2               4.0.0     DigitalOcean API v2 client f...
vlucas/phpdotenv                     v5.2.0    Loads environment variables ...
voku/portable-ascii                  1.5.6     Portable ASCII library - per...
webmozart/assert                     1.9.1     Assertions to validate metho...
GrahamCampbell commented 3 years ago

Please update your dependencies and try now.

alikmanukian commented 3 years ago

Now it works good!

Thanks.