Skip to content

Commit 4139013

Browse files
committed
Support customizing http client via filters
1 parent b10661c commit 4139013

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

components/Blueprints/Runner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function __construct( RunnerConfiguration $configuration ) {
114114
$this->configuration = $configuration;
115115
$this->validateConfiguration( $configuration );
116116

117-
$this->client = new Client();
117+
$this->client = apply_filters('blueprint.http_client', new Client());
118118
$this->mainTracker = new Tracker();
119119

120120
// Set up progress logging

components/HttpClient/Client.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,14 @@ class Client {
3737
public function __construct( $options = array() ) {
3838
$this->state = new ClientState( $options );
3939
if(empty($options['transport']) || $options['transport'] === 'auto') {
40-
$options['transport'] = extension_loaded( 'curl' ) ? 'curl' : 'socket';
40+
$options['transport'] = extension_loaded( 'curl' ) ? 'curl' : 'sockets';
4141
}
42-
$options['transport'] = 'socket';
4342

4443
switch ( $options['transport'] ) {
4544
case 'curl':
4645
$transport = new CurlTransport( $this->state );
4746
break;
48-
case 'socket':
47+
case 'sockets':
4948
$transport = new SocketTransport( $this->state );
5049
break;
5150
default:

0 commit comments

Comments
 (0)