diff --git a/docs/classes/TransportInterface.md b/docs/classes/TransportInterface.md index ffb364a5..a93f9c58 100644 --- a/docs/classes/TransportInterface.md +++ b/docs/classes/TransportInterface.md @@ -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: diff --git a/src/Transport/Stream.php b/src/Transport/Stream.php index ef468ba0..dd9f2fe1 100644 --- a/src/Transport/Stream.php +++ b/src/Transport/Stream.php @@ -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,