doRequest example

 else {
            $this->hasPerformedRequest = true;
        }

        if ($this->profiler) {
            $this->profiler = false;

            $this->kernel->boot();
            $this->getContainer()->get('profiler')->enable();
        }

        return parent::doRequest($request);
    }

    /** * @param Request $request */
    protected function doRequestInProcess(object $request): Response
    {
        $response = parent::doRequestInProcess($request);

        $this->profiler = false;

        

  public function getSecurityAdvisories(bool $allow_outgoing_request = TRUE, int $timeout = 0): ?array {
    $advisories = [];

    $json_payload = $this->keyValueExpirable->get(self::ADVISORIES_JSON_EXPIRABLE_KEY);
    // If $json_payload is not an array then it was not set in this method or     // has expired in which case we should try to retrieve the advisories.     if (!is_array($json_payload)) {
      if (!$allow_outgoing_request) {
        return NULL;
      }
      $response = $this->doRequest($timeout);
      $interval_seconds = $this->config->get('interval_hours') * 60 * 60;
      $json_payload = Json::decode($response);
      if (is_array($json_payload)) {
        // Only store and use the response if it could be successfully         // decoded to an array from the JSON string.         // This value will be deleted if the 'advisories.interval_hours' config         // is changed to a lower value.         // @see \Drupal\update\EventSubscriber\ConfigSubscriber::onConfigSave()         $this->keyValueExpirable->setWithExpire(self::ADVISORIES_JSON_EXPIRABLE_KEY, $json_payload$interval_seconds);
      }
      else {
        
$this->internalRequest = new Request($uri$method$parameters$files$this->cookieJar->allValues($uri)$server$content);

        $this->request = $this->filterRequest($this->internalRequest);

        if (true === $changeHistory) {
            $this->history->add($this->internalRequest);
        }

        if ($this->insulated) {
            $this->response = $this->doRequestInProcess($this->request);
        } else {
            $this->response = $this->doRequest($this->request);
        }

        $this->internalResponse = $this->filterResponse($this->response);

        $this->cookieJar->updateFromResponse($this->internalResponse, $uri);

        $status = $this->internalResponse->getStatusCode();

        if ($status >= 300 && $status < 400) {
            $this->redirect = $this->internalResponse->getHeader('Location');
        } else {
            
$this->nextResponse = $response;
    }

    public function setNextScript(string $script)
    {
        $this->nextScript = $script;
    }

    protected function doRequest(object $request): Response
    {
        if (null === $this->nextResponse) {
            return parent::doRequest($request);
        }

        $response = $this->nextResponse;
        $this->nextResponse = null;

        return $response;
    }

    protected function getScript(object $request): string
    {
        $r = new \ReflectionClass(Response::class);
        


        $requestPayload = [
            'criterion' => [
                'version' => [
                    $version,
                ],
                'pluginName' => $names,
            ],
        ];

        return $this->doRequest($requestPayload);
    }

    /** * @param string[] $names * * @return array */
    public function getProductsByNames(array $names)
    {
        if (empty($names)) {
            return [];
        }
if ($this->logger === NULL) {
      @trigger_error('Calling ' . __METHOD__ . '() without the $logger argument is deprecated in drupal:10.1.0 and it will be required in drupal:11.0.0. See https://www.drupal.org/node/2932520', E_USER_DEPRECATED);
      $this->logger = \Drupal::service('logger.channel.update');
    }
  }

  /** * {@inheritdoc} */
  public function fetchProjectData(array $project$site_key = '') {
    $url = $this->buildFetchUrl($project$site_key);
    return $this->doRequest($url['headers' => ['Accept' => 'text/xml']]$this->withHttpFallback);
  }

  /** * Applies a GET request with a possible HTTP fallback. * * This method falls back to HTTP in case there was some certificate * problem. * * @param string $url * The URL. * @param array $options * The guzzle client options. * @param bool $with_http_fallback * Should the function fall back to HTTP. * * @return string * The body of the HTTP(S) request, or an empty string on failure. */
$this->httpKernel = $this->container->get('http_kernel');
  }

  /** * Test core functions of the linkset for multilingual behaviour. * * @throws \Exception */
  public function testBasicMultilingualFunctions() {
    foreach (['aa', 'bb', 'cc', 'dd'] as $language_code) {
      $expected_linkset = $this->getReferenceLinksetDataFromFile(__DIR__ . '/../../../fixtures/linkset/linkset-menu-main-multilingual-' . $language_code . '.json');
      $response = $this->doRequest('GET', Url::fromUri('base:/' . $language_code . '/system/menu/main/linkset'));
      $this->assertSame($expected_linkset, Json::decode((string) $response->getBody()));
    }
  }

  /** * Test core functions of the linkset for multilingual behaviour. * * @throws \Exception */
  public function testDefaultMultilingualFunctions() {
    $expected_linkset = $this->getReferenceLinksetDataFromFile(__DIR__ . '/../../../fixtures/linkset/linkset-menu-main-multilingual-default.json');
    

  public function testBasicFunctions() {
    $this->enableEndpoint(TRUE);
    $expected_linkset = $this->getReferenceLinksetDataFromFile(__DIR__ . '/../../../fixtures/linkset/linkset-menu-main.json');
    $response = $this->doRequest('GET', Url::fromUri('base:/system/menu/main/linkset'));
    $this->assertSame('application/linkset+json', $response->getHeaderLine('content-type'));
    $this->assertSame($expected_linkset, Json::decode((string) $response->getBody()));
    $this->doRequest('GET', Url::fromUri('base:/system/menu/missing/linkset'), 404);
  }

  /** * Test the cacheability of the linkset endpoint. * * This test's purpose is to ensure that the menu linkset response is properly * cached. It does this by sending a request and validating it has a cache * miss and the correct cacheability meta, then by sending the same request to * assert a cache hit. Finally, a new menu item is created to ensure that the * cached response is properly invalidated. */
Home | Imprint | This part of the site doesn't use cookies.