Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ Generic `Request<TResponse>` ensures `$client->send(request: $request)` returns
composer require zlodes/http-client
```

You'll also need a PSR-7 implementation and a PSR-18 HTTP client:
You'll also need a PSR-7 implementation and any PSR-18 HTTP client, for example:

```bash
composer require guzzlehttp/psr7 guzzlehttp/guzzle
composer require guzzlehttp/psr7 symfony/http-client
```

Optional integrations such as logging and metrics are up to your application and middleware choices.
Expand Down Expand Up @@ -378,10 +378,7 @@ $client = new HttpClient(
);
```

Which transport actually applies the options:

- `GuzzleTransport` maps them to Guzzle's `timeout` and `connect_timeout`, and sends with `http_errors` disabled. A cURL timeout (error 28) is thrown as `TransportTimeoutException`, which extends `TransportException`, so a timeout is distinguishable from a refused connection.
- `Psr18Transport` ignores them. PSR-18 has no per-request options, so configure timeouts on the wrapped client instead.
The bundled `Psr18Transport` ignores them. PSR-18 has no per-request options, so configure timeouts on the wrapped client instead. To honour per-request options, implement your own `Transport` and read them from the `TransportOptions` argument. Throw `TransportTimeoutException` (extends `TransportException`) on timeout so callers can tell a timeout from a refused connection.

## Default headers

Expand Down
4 changes: 1 addition & 3 deletions UPGRADE-1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,4 @@ $transport->shouldReceive('send')->once()->with(Mockery::on($matcher), Mockery::

Set them with `WithTimeout` on a `ClientFactory`, with `TimeoutMiddleware` directly, or per endpoint by implementing `HasTransportOptions`. Precedence is request > client > global default.

`Psr18Transport` ignores `TransportOptions`. PSR-18 has no per-request options; configure timeouts on the wrapped client.

`GuzzleTransport` applies them. It requires `guzzlehttp/guzzle`, which this library now depends on.
`Psr18Transport` ignores `TransportOptions`. PSR-18 has no per-request options; configure timeouts on the wrapped client, or implement a custom `Transport` that applies them.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"type": "library",
"require": {
"php": "^8.4",
"guzzlehttp/guzzle": "^7.9",
"psr/http-client": "^1.0",
"psr/http-message": "^2.0"
},
Expand Down
61 changes: 0 additions & 61 deletions src/Transport/GuzzleTransport.php

This file was deleted.

204 changes: 0 additions & 204 deletions tests/Transport/GuzzleTransportTest.php

This file was deleted.

Loading