diff --git a/composer.json b/composer.json index 166aac8..8c23635 100644 --- a/composer.json +++ b/composer.json @@ -19,6 +19,7 @@ "php": "^7.0", "api-clients/client-services": "dev-master", "api-clients/foundation": "dev-master", + "api-clients/middleware-token-authorization": "dev-master", "api-clients/pusher": "dev-master", "api-clients/rx": "dev-master" }, diff --git a/composer.lock b/composer.lock index c9887b8..62f0970 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "afde6a6f151534a615bcf71d2f716c3b", - "content-hash": "26ef6302ea6aede976286d94c215e214", + "content-hash": "c7b04e1860e88a13b83717d8572b7faf", "packages": [ { "name": "api-clients/client-services", @@ -97,7 +96,7 @@ } ], "description": "Light weight wrapper around league/tactician adding promised based interface(s) and next tick execution", - "time": "2016-12-08 08:36:09" + "time": "2016-12-08T08:36:09+00:00" }, { "name": "api-clients/foundation", @@ -261,7 +260,49 @@ } ], "description": "Request middleware", - "time": "2016-12-05 07:52:20" + "time": "2016-12-05T07:52:20+00:00" + }, + { + "name": "api-clients/middleware-token-authorization", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/php-api-clients/middleware-token-authorization.git", + "reference": "7ca2935d9f7d57e1ce04ce00de25de576d345f22" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-api-clients/middleware-token-authorization/zipball/7ca2935d9f7d57e1ce04ce00de25de576d345f22", + "reference": "7ca2935d9f7d57e1ce04ce00de25de576d345f22", + "shasum": "" + }, + "require": { + "api-clients/middleware": "^1.0", + "php": "^7.0" + }, + "require-dev": { + "api-clients/test-utilities": "^2.0", + "ringcentral/psr7": "^1.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "ApiClients\\Middleware\\TokenAuthorization\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Cees-Jan Kiewiet", + "email": "ceesjank@gmail.com" + } + ], + "description": "Token authorization middleware", + "homepage": "https://php-api-clients.org/clients/travis/", + "time": "2017-01-11 16:25:38" }, { "name": "api-clients/pusher", @@ -356,7 +397,7 @@ } ], "description": "Abstract resource", - "time": "2016-12-09 16:48:22" + "time": "2016-12-09T16:48:22+00:00" }, { "name": "api-clients/rx", @@ -552,7 +593,7 @@ "reactphp", "synchronous" ], - "time": "2016-03-09 15:10:22" + "time": "2016-03-09T15:10:22+00:00" }, { "name": "clue/buzz-react", @@ -607,7 +648,7 @@ "http client", "reactphp" ], - "time": "2016-10-21 10:29:37" + "time": "2016-10-21T10:29:37+00:00" }, { "name": "container-interop/container-interop", @@ -634,7 +675,7 @@ "MIT" ], "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", - "time": "2014-12-30 15:22:37" + "time": "2014-12-30T15:22:37+00:00" }, { "name": "daverandom/exceptional-json", @@ -669,7 +710,7 @@ } ], "description": "JSON encoding and decoding that throws exceptions on failure", - "time": "2016-05-04 15:52:54" + "time": "2016-05-04T15:52:54+00:00" }, { "name": "doctrine/annotations", @@ -737,7 +778,7 @@ "docblock", "parser" ], - "time": "2016-12-30 15:59:45" + "time": "2016-12-30T15:59:45+00:00" }, { "name": "doctrine/cache", @@ -807,7 +848,7 @@ "cache", "caching" ], - "time": "2016-10-29 11:16:17" + "time": "2016-10-29T11:16:17+00:00" }, { "name": "doctrine/lexer", @@ -861,7 +902,7 @@ "lexer", "parser" ], - "time": "2014-09-09 13:34:57" + "time": "2014-09-09T13:34:57+00:00" }, { "name": "evenement/evenement", @@ -907,7 +948,7 @@ "event-dispatcher", "event-emitter" ], - "time": "2012-11-02 14:49:47" + "time": "2012-11-02T14:49:47+00:00" }, { "name": "guzzlehttp/psr7", @@ -965,7 +1006,7 @@ "stream", "uri" ], - "time": "2016-06-24 23:00:38" + "time": "2016-06-24T23:00:38+00:00" }, { "name": "igorw/get-in", @@ -1010,7 +1051,7 @@ "assoc-array", "hash-map" ], - "time": "2014-12-15 23:03:51" + "time": "2014-12-15T23:03:51+00:00" }, { "name": "joshdifabio/composed", @@ -1059,7 +1100,7 @@ "dependency", "package" ], - "time": "2015-07-16 22:30:20" + "time": "2015-07-16T22:30:20+00:00" }, { "name": "league/event", @@ -1109,7 +1150,7 @@ "event", "listener" ], - "time": "2015-05-21 12:24:47" + "time": "2015-05-21T12:24:47+00:00" }, { "name": "league/tactician", @@ -1160,7 +1201,7 @@ "command bus", "service layer" ], - "time": "2016-02-20 11:14:36" + "time": "2016-02-20T11:14:36+00:00" }, { "name": "league/tactician-container", @@ -1211,7 +1252,7 @@ "league", "tactician" ], - "time": "2015-12-31 12:41:26" + "time": "2015-12-31T12:41:26+00:00" }, { "name": "nikic/php-parser", @@ -1262,7 +1303,7 @@ "parser", "php" ], - "time": "2016-09-16 12:04:44" + "time": "2016-09-16T12:04:44+00:00" }, { "name": "ocramius/code-generator-utils", @@ -1317,7 +1358,7 @@ "php code", "reflection" ], - "time": "2016-01-12 09:22:58" + "time": "2016-01-12T09:22:58+00:00" }, { "name": "ocramius/generated-hydrator", @@ -1375,7 +1416,7 @@ "performance", "serializer" ], - "time": "2016-01-12 11:39:06" + "time": "2016-01-12T11:39:06+00:00" }, { "name": "ocramius/package-versions", @@ -1423,7 +1464,7 @@ } ], "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", - "time": "2016-12-30 09:49:15" + "time": "2016-12-30T09:49:15+00:00" }, { "name": "php-di/invoker", @@ -1466,7 +1507,7 @@ "invoke", "invoker" ], - "time": "2016-07-14 13:09:58" + "time": "2016-07-14T13:09:58+00:00" }, { "name": "php-di/php-di", @@ -1526,7 +1567,7 @@ "dependency injection", "di" ], - "time": "2016-08-23 20:18:00" + "time": "2016-08-23T20:18:00+00:00" }, { "name": "php-di/phpdoc-reader", @@ -1563,7 +1604,7 @@ "phpdoc", "reflection" ], - "time": "2015-11-29 10:34:25" + "time": "2015-11-29T10:34:25+00:00" }, { "name": "psr/http-message", @@ -1613,7 +1654,7 @@ "request", "response" ], - "time": "2016-08-06 14:39:51" + "time": "2016-08-06T14:39:51+00:00" }, { "name": "react/cache", @@ -1647,7 +1688,7 @@ "keywords": [ "cache" ], - "time": "2016-02-25 18:17:16" + "time": "2016-02-25T18:17:16+00:00" }, { "name": "react/dns", @@ -1684,7 +1725,7 @@ "dns", "dns-resolver" ], - "time": "2016-08-01 10:09:07" + "time": "2016-08-01T10:09:07+00:00" }, { "name": "react/event-loop", @@ -1728,7 +1769,7 @@ "asynchronous", "event-loop" ], - "time": "2016-03-08 02:09:32" + "time": "2016-03-08T02:09:32+00:00" }, { "name": "react/http", @@ -1765,7 +1806,7 @@ "keywords": [ "http" ], - "time": "2016-11-09 15:20:39" + "time": "2016-11-09T15:20:39+00:00" }, { "name": "react/http-client", @@ -1805,7 +1846,7 @@ "keywords": [ "http" ], - "time": "2016-12-02 10:17:42" + "time": "2016-12-02T10:17:42+00:00" }, { "name": "react/promise", @@ -1848,7 +1889,7 @@ "promise", "promises" ], - "time": "2016-12-22 14:09:01" + "time": "2016-12-22T14:09:01+00:00" }, { "name": "react/promise-timer", @@ -1898,7 +1939,7 @@ "timeout", "timer" ], - "time": "2016-12-27 08:12:19" + "time": "2016-12-27T08:12:19+00:00" }, { "name": "react/socket", @@ -1934,7 +1975,7 @@ "keywords": [ "Socket" ], - "time": "2016-12-19 22:52:38" + "time": "2016-12-19T22:52:38+00:00" }, { "name": "react/socket-client", @@ -1975,7 +2016,7 @@ "keywords": [ "Socket" ], - "time": "2016-12-24 11:19:15" + "time": "2016-12-24T11:19:15+00:00" }, { "name": "react/stream", @@ -2019,7 +2060,7 @@ "pipe", "stream" ], - "time": "2016-11-13 17:06:02" + "time": "2016-11-13T17:06:02+00:00" }, { "name": "reactivex/rxphp", @@ -2085,7 +2126,7 @@ "reactive", "rx" ], - "time": "2016-12-28 22:50:58" + "time": "2016-12-28T22:50:58+00:00" }, { "name": "ringcentral/psr7", @@ -2143,7 +2184,7 @@ "stream", "uri" ], - "time": "2016-03-25 17:36:49" + "time": "2016-03-25T17:36:49+00:00" }, { "name": "rx/websocket", @@ -2199,7 +2240,7 @@ "rxphp", "websocket" ], - "time": "2016-02-09 03:27:41" + "time": "2016-02-09T03:27:41+00:00" }, { "name": "voryx/event-loop", @@ -2251,7 +2292,7 @@ "static", "timer" ], - "time": "2015-11-23 22:10:36" + "time": "2015-11-23T22:10:36+00:00" }, { "name": "wyrihaximus/tactician-command-handler-mapper", @@ -2296,7 +2337,7 @@ } ], "description": "Command to Handler mapper for Tactician", - "time": "2016-09-06 09:52:48" + "time": "2016-09-06T09:52:48+00:00" }, { "name": "wyrihaximus/ticking-promise", @@ -2342,7 +2383,7 @@ } ], "description": "Wrapping ticks into a promise", - "time": "2016-03-05 20:23:05" + "time": "2016-03-05T20:23:05+00:00" }, { "name": "zendframework/zend-hydrator", @@ -2404,7 +2445,7 @@ "hydrator", "zf2" ], - "time": "2016-04-18 17:59:29" + "time": "2016-04-18T17:59:29+00:00" }, { "name": "zendframework/zend-stdlib", @@ -2449,7 +2490,7 @@ "stdlib", "zf2" ], - "time": "2016-09-13 14:38:50" + "time": "2016-09-13T14:38:50+00:00" } ], "packages-dev": [ @@ -2675,7 +2716,7 @@ "email": "ceesjank@gmail.com" } ], - "time": "2016-12-08 07:01:48" + "time": "2016-12-08T07:01:48+00:00" }, { "name": "doctrine/inflector", @@ -2742,7 +2783,7 @@ "singularize", "string" ], - "time": "2015-11-06 14:35:42" + "time": "2015-11-06T14:35:42+00:00" }, { "name": "doctrine/instantiator", @@ -2796,7 +2837,7 @@ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2015-06-14T21:17:01+00:00" }, { "name": "friendsofphp/php-cs-fixer", @@ -2854,7 +2895,7 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2016-08-16 23:31:05" + "time": "2016-08-16T23:31:05+00:00" }, { "name": "jakub-onderka/php-console-color", @@ -2897,7 +2938,7 @@ "homepage": "http://www.acci.cz" } ], - "time": "2014-04-08 15:00:19" + "time": "2014-04-08T15:00:19+00:00" }, { "name": "jakub-onderka/php-console-highlighter", @@ -2941,7 +2982,7 @@ "homepage": "http://www.acci.cz/" } ], - "time": "2015-04-20 18:58:01" + "time": "2015-04-20T18:58:01+00:00" }, { "name": "jakub-onderka/php-parallel-lint", @@ -2988,7 +3029,7 @@ ], "description": "This tool check syntax of PHP files about 20x faster than serial check.", "homepage": "https://github.com/JakubOnderka/PHP-Parallel-Lint", - "time": "2015-12-15 10:42:16" + "time": "2015-12-15T10:42:16+00:00" }, { "name": "joshdifabio/resource-pool", @@ -3040,7 +3081,7 @@ "promise", "reactphp" ], - "time": "2016-12-30 13:38:38" + "time": "2016-12-30T13:38:38+00:00" }, { "name": "myclabs/deep-copy", @@ -3082,7 +3123,7 @@ "object", "object graph" ], - "time": "2016-10-31 17:19:45" + "time": "2016-10-31T17:19:45+00:00" }, { "name": "phake/phake", @@ -3140,7 +3181,7 @@ "mock", "testing" ], - "time": "2016-03-04 18:49:33" + "time": "2016-03-04T18:49:33+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -3194,7 +3235,7 @@ "reflection", "static analysis" ], - "time": "2015-12-27 11:43:31" + "time": "2015-12-27T11:43:31+00:00" }, { "name": "phpdocumentor/reflection-docblock", @@ -3239,7 +3280,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-09-30 07:12:33" + "time": "2016-09-30T07:12:33+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -3286,7 +3327,7 @@ "email": "me@mikevanriel.com" } ], - "time": "2016-11-25 06:54:22" + "time": "2016-11-25T06:54:22+00:00" }, { "name": "phpspec/prophecy", @@ -3349,7 +3390,7 @@ "spy", "stub" ], - "time": "2016-11-21 14:58:47" + "time": "2016-11-21T14:58:47+00:00" }, { "name": "phpunit/php-code-coverage", @@ -3412,7 +3453,7 @@ "testing", "xunit" ], - "time": "2016-12-20 15:22:42" + "time": "2016-12-20T15:22:42+00:00" }, { "name": "phpunit/php-file-iterator", @@ -3459,7 +3500,7 @@ "filesystem", "iterator" ], - "time": "2016-10-03 07:40:28" + "time": "2016-10-03T07:40:28+00:00" }, { "name": "phpunit/php-text-template", @@ -3500,7 +3541,7 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", @@ -3544,7 +3585,7 @@ "keywords": [ "timer" ], - "time": "2016-05-12 18:03:57" + "time": "2016-05-12T18:03:57+00:00" }, { "name": "phpunit/php-token-stream", @@ -3593,7 +3634,7 @@ "keywords": [ "tokenizer" ], - "time": "2016-11-15 14:06:22" + "time": "2016-11-15T14:06:22+00:00" }, { "name": "phpunit/phpunit", @@ -3675,7 +3716,7 @@ "testing", "xunit" ], - "time": "2016-12-28 07:18:51" + "time": "2016-12-28T07:18:51+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -3734,7 +3775,7 @@ "mock", "xunit" ], - "time": "2016-12-08 20:27:08" + "time": "2016-12-08T20:27:08+00:00" }, { "name": "psr/log", @@ -3781,7 +3822,7 @@ "psr", "psr-3" ], - "time": "2016-10-10 12:19:37" + "time": "2016-10-10T12:19:37+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -3826,7 +3867,7 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2016-02-13 06:45:14" + "time": "2016-02-13T06:45:14+00:00" }, { "name": "sebastian/comparator", @@ -3890,7 +3931,7 @@ "compare", "equality" ], - "time": "2016-11-19 09:18:40" + "time": "2016-11-19T09:18:40+00:00" }, { "name": "sebastian/diff", @@ -3942,7 +3983,7 @@ "keywords": [ "diff" ], - "time": "2015-12-08 07:14:41" + "time": "2015-12-08T07:14:41+00:00" }, { "name": "sebastian/environment", @@ -3992,7 +4033,7 @@ "environment", "hhvm" ], - "time": "2016-11-26 07:53:53" + "time": "2016-11-26T07:53:53+00:00" }, { "name": "sebastian/exporter", @@ -4059,7 +4100,7 @@ "export", "exporter" ], - "time": "2016-11-19 08:54:04" + "time": "2016-11-19T08:54:04+00:00" }, { "name": "sebastian/global-state", @@ -4110,7 +4151,7 @@ "keywords": [ "global state" ], - "time": "2015-10-12 03:26:01" + "time": "2015-10-12T03:26:01+00:00" }, { "name": "sebastian/object-enumerator", @@ -4156,7 +4197,7 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2016-11-19 07:35:10" + "time": "2016-11-19T07:35:10+00:00" }, { "name": "sebastian/recursion-context", @@ -4209,7 +4250,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-11-19 07:33:16" + "time": "2016-11-19T07:33:16+00:00" }, { "name": "sebastian/resource-operations", @@ -4251,7 +4292,7 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28 20:34:47" + "time": "2015-07-28T20:34:47+00:00" }, { "name": "sebastian/version", @@ -4294,7 +4335,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03 07:35:21" + "time": "2016-10-03T07:35:21+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -4372,7 +4413,7 @@ "phpcs", "standards" ], - "time": "2016-11-30 04:02:31" + "time": "2016-11-30T04:02:31+00:00" }, { "name": "symfony/console", @@ -4435,7 +4476,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-12-11 14:34:22" + "time": "2016-12-11T14:34:22+00:00" }, { "name": "symfony/debug", @@ -4492,7 +4533,7 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2016-11-16 22:18:16" + "time": "2016-11-16T22:18:16+00:00" }, { "name": "symfony/event-dispatcher", @@ -4552,7 +4593,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2016-10-13 06:29:04" + "time": "2016-10-13T06:29:04+00:00" }, { "name": "symfony/filesystem", @@ -4601,7 +4642,7 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2016-11-24 00:46:43" + "time": "2016-11-24T00:46:43+00:00" }, { "name": "symfony/finder", @@ -4650,7 +4691,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2016-12-13 09:39:43" + "time": "2016-12-13T09:39:43+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -4709,7 +4750,7 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2016-11-14T01:06:16+00:00" }, { "name": "symfony/process", @@ -4758,7 +4799,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2016-11-24 10:40:28" + "time": "2016-11-24T10:40:28+00:00" }, { "name": "symfony/stopwatch", @@ -4807,7 +4848,7 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2016-06-29 05:43:10" + "time": "2016-06-29T05:43:10+00:00" }, { "name": "symfony/yaml", @@ -4862,7 +4903,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-12-10 10:07:06" + "time": "2016-12-10T10:07:06+00:00" }, { "name": "webmozart/assert", @@ -4912,7 +4953,7 @@ "check", "validate" ], - "time": "2016-11-23 20:04:58" + "time": "2016-11-23T20:04:58+00:00" } ], "aliases": [], @@ -4920,6 +4961,7 @@ "stability-flags": { "api-clients/client-services": 20, "api-clients/foundation": 20, + "api-clients/middleware-token-authorization": 20, "api-clients/pusher": 20, "api-clients/rx": 20, "api-clients/middleware-delay": 20, diff --git a/src/ApiSettings.php b/src/ApiSettings.php index 1ff72fe..800c4d7 100644 --- a/src/ApiSettings.php +++ b/src/ApiSettings.php @@ -8,7 +8,8 @@ use ApiClients\Foundation\Transport\Middleware\JsonEncodeMiddleware; use ApiClients\Foundation\Transport\Options as TransportOptions; use ApiClients\Foundation\Transport\UserAgentStrategies; -use ApiClients\Client\Travis\Middleware\TokenAuthorizationHeaderMiddleware; +use ApiClients\Middleware\TokenAuthorization\Options as TokenAuthorizationHeaderMiddlewareOptions; +use ApiClients\Middleware\TokenAuthorization\TokenAuthorizationHeaderMiddleware; use function ApiClients\Foundation\options_merge; final class ApiSettings @@ -64,7 +65,7 @@ public static function getOptions( $transportOptions[TransportOptions::DEFAULT_REQUEST_OPTIONS] ?? [], [ TokenAuthorizationHeaderMiddleware::class => [ - Options::TOKEN => $token, + TokenAuthorizationHeaderMiddlewareOptions::TOKEN => $token, ], ] ); diff --git a/src/Middleware/TokenAuthorizationHeaderMiddleware.php b/src/Middleware/TokenAuthorizationHeaderMiddleware.php deleted file mode 100644 index 62d8fe5..0000000 --- a/src/Middleware/TokenAuthorizationHeaderMiddleware.php +++ /dev/null @@ -1,46 +0,0 @@ -withAddedHeader( - 'Authorization', - 'token ' . $options[self::class][Options::TOKEN] - ) - ); - } -} diff --git a/src/Options.php b/src/Options.php deleted file mode 100644 index 09baaf9..0000000 --- a/src/Options.php +++ /dev/null @@ -1,12 +0,0 @@ - [ - Options::TOKEN => 'foo.bar', + TokenAuthorizationHeaderMiddlewareOptions::TOKEN => 'foo.bar', ], ] ); diff --git a/tests/Middleware/TokenAuthorizationHeaderMiddlewareTest.php b/tests/Middleware/TokenAuthorizationHeaderMiddlewareTest.php deleted file mode 100644 index 27c5d94..0000000 --- a/tests/Middleware/TokenAuthorizationHeaderMiddlewareTest.php +++ /dev/null @@ -1,71 +0,0 @@ - [ - Options::TOKEN => '', - ], - ], - false, - '' - ]; - - yield [ - [ - TokenAuthorizationHeaderMiddleware::class => [ - Options::TOKEN => null, - ], - ], - false, - '' - ]; - - yield [ - [ - TokenAuthorizationHeaderMiddleware::class => [ - Options::TOKEN => 'kroket', - ], - ], - true, - 'token kroket' - ]; - } - - /** - * @dataProvider preProvider - */ - public function testPre(array $options, bool $hasHeader, string $expectedHeader) - { - $request = new Request('GET', 'https://example.com/'); - $middleware = new TokenAuthorizationHeaderMiddleware(); - $changedRequest = await($middleware->pre($request, $options), Factory::create()); - - if ($hasHeader === false) { - $this->assertFalse($changedRequest->hasHeader('Authorization')); - return; - } - - $this->assertTrue($changedRequest->hasHeader('Authorization')); - $this->assertSame($expectedHeader, $changedRequest->getHeaderLine('Authorization')); - } -}