Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Message.php

function Message::parseRequest

Parses a request message string into a request object.

Parameters

string $message Request message string.:

File

vendor/guzzlehttp/psr7/src/Message.php, line 201

Class

Message

Namespace

GuzzleHttp\Psr7

Code

public static function parseRequest(string $message) : RequestInterface {
    $data = self::parseMessage($message);
    $matches = [];
    if (!preg_match('/^[\\S]+\\s+([a-zA-Z]+:\\/\\/|\\/).*/', $data['start-line'], $matches)) {
        throw new \InvalidArgumentException('Invalid request string');
    }
    $parts = explode(' ', $data['start-line'], 3);
    $version = isset($parts[2]) ? explode('/', $parts[2])[1] : '1.1';
    $request = new Request($parts[0], $matches[1] === '/' ? self::parseRequestUri($parts[1], $data['headers']) : $parts[1], $data['headers'], $data['body'], $version);
    return $matches[1] === '/' ? $request : $request->withRequestTarget($parts[1]);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal