Skip to content
Open
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
4 changes: 4 additions & 0 deletions docs/classes/TransportInterface.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ recorded requests are available for assertions.

## Options

The stream transport creates its own stream context for each request, so options set on PHP's default
context with `stream_context_set_default()` (a proxy, extra headers, …) are not used. Pass them with the
`transport.stream` option, which is merged into the context's `http` options, or with the options below.

`AbstractTransport::__construct($options = [])` accepts an array or `ArrayAccess`. Options are read
with `getOption($key, $default)` and are transport-specific; the commonly used ones are:

Expand Down
9 changes: 0 additions & 9 deletions src/Transport/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,6 @@ public function request(
$options[$key] = $value;
}

// Get the current context options.
$contextOptions = stream_context_get_options(stream_context_get_default());

// Add our options to the currently defined options, if any.
$contextOptions['http'] = isset($contextOptions['http']) ? array_merge(
$contextOptions['http'],
$options
) : $options;

// Create the stream context for the request.
$streamOptions = [
'http' => $options,
Expand Down
Loading