Commit 883f54ac authored by Alan Sherry's avatar Alan Sherry Committed by Alan Sherry
Browse files

Issue #3312381 by asherry: Options do not clear between requests, including query parameters

parent 6b653095
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Drupal\apitools;

use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Http\ClientFactory as HttpClient;
use Drupal\Core\Plugin\PluginBase;
use Drupal\Core\TempStore\SharedTempStore;
@@ -128,10 +129,11 @@ abstract class ClientBase extends PluginBase implements ClientInterface {
   */
  public function request($method, $path, $options = []) {
    $response = NULL;
    $path = $this->options->get('base_path') . '/' . $path;
    $this->options->add($options);
    $request_options = clone $this->options;
    $request_options->replace(NestedArray::mergeDeep($request_options->all(), $options));
    $path = $request_options->get('base_path') . '/' . $path;
    try {
      $response = $this->httpClient->{$method}($path, $this->options->all());
      $response = $this->httpClient->{$method}($path, $request_options->all());
      $response = $response->getBody()->getContents();
    }
    catch (\Exception $e) {