Proxy to ServerRequestInterface::withBody()

{@inheritdoc}
488077
public function withBody(StreamInterface $body)
    {
        $new = $this->psrRequest->withBody($body);
        return new self($new, $this->originalRequest);
    }
873481
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
	{
		$response = $handler->handle($request);

		if (!$response->hasHeader('Content-Encoding') &&
			stripos($request->getHeaderLine('Accept-Encoding'), $this->encoding) !== false
		) {
			$body = (string) $response->getBody();
			$encoded = $this->encode($body);
			$stream = Factory::stream($encoded);

			$response = $response
				->withHeader('Content-Encoding', $this->encoding)
				->withBody($stream);

			return Helpers::fixContentLength($response);
		}

		return $response;
	}
624894
public function handle(ServerRequestInterface $request): ResponseInterface
    {
        $input = $this->input($request);

        $payload = $this->domain->payload($input);

        return $this->responder->response($request, $payload);
    }
267105
public function createRequest(string $method, string $uri, array $body = []): RequestInterface
    {
        $request = $this->requestFactory->createRequest($method, $uri)
            ->withHeader('Content-Type', 'application/json')
            ->withHeader('Authorization', 'Token ' . $this->token)
            ->withHeader('X-Secret', $this->secret)
        ;

        if (!empty($body)) {
            $request = $request
                ->withBody($this->streamFactory->createStream(json_encode($body, JSON_UNESCAPED_UNICODE)))
            ;
        }

        return $request;
    }
1240751
public function _request($body)
    {
        if(isset($body['params'])){
            $response = $this->client->send($this->client->request(0, $body['method'], $body['params']));
        } else {
            $response = $this->client->send($this->client->request(0, $body['method']));
        }
        $response = json_decode($response->getBody());
        // if there is an error, return the error message otherwise respond with result
        if(property_exists($response, 'error')){
            return json_encode($response->error);
        } else {
            return json_encode($response->result);
        }
    }
358976
public function build(): TakeResponseBodyAsStreamRequest
	{
		$instance = new TakeResponseBodyAsStreamRequest();
		if ($this->requestId === null) {
			throw new BuilderException('Property [requestId] is required.');
		}
		$instance->requestId = $this->requestId;
		return $instance;
	}
247406
public function html(string $body): ResponseInterface
    {
        $response = $this->responseFactory->createResponse();
        $response->getBody()->write($body);

        return $response->withHeader('Content-type', 'text/html; charset=UTF-8');
    }
1140751
protected function setBody($body = 'php://temp')
    {
        if (is_string($body) || is_resource($body)) {
            $body = new Stream($body, 'w+b');
        }
        if (! $body instanceof StreamInterface) {
            throw new InvalidArgumentException(sprintf(
                'Invalid body provided. Must be a string resource identifier, or resource, '
                . 'or instance of Psr\Http\Message\StreamInterface; received "%s".',
                is_object($body) ? get_class($body) : gettype($body)
            ));
        }
        $this->setBodyInstance($body);

        return $this;
    }
1097079
public function createServerRequestFromServer(): ServerRequestInterface
        {
            $method  = $_SERVER['REQUEST_METHOD'];
            $uri     = (new UriFactory)->createUriFromServer($_SERVER);
            $files   = (new UploadedFileFactory)->createUploadedFileFromServer($_FILES);
            
            $request = $this->createServerRequest($method, $uri, $_SERVER);
            $request = $request->withQueryParams($_GET);
            $request = $request->withParsedBody($_POST);
            $request = $request->withCookieParams($_COOKIE);
            $request = $request->withUploadedFiles($files);
            return $request;
        }
93434
private function setBody(TransportRequestInterface $transportRequest, $body)
    {
        if (null !== $body) {
            $transportRequest->setBody($body);
        }

        return $transportRequest;
    }
1317593
function withRequestOnMatch(RequestInterface $request)
    {
        $requestTarget = $request->getRequestTarget();
        $requestTarget = new StdString($requestTarget);
        $requestTarget = $requestTarget->stripPrefix( rtrim($this->_stripPrefix, '/') );
        $request       = $request->withRequestTarget( (string) $requestTarget );

        return $request;
    }
785662
public final function withBody(StreamInterface $body): MessageInterface
   {
       if (!$body->getMetadata("uri")) {
           throw new InvalidArgumentException(
               "Can't get instance for body: invalid stream");
       }
       return $this->with("body", $body);
   }
694949
public function build(): GetResponseBodyRequest
	{
		$instance = new GetResponseBodyRequest();
		if ($this->requestId === null) {
			throw new BuilderException('Property [requestId] is required.');
		}
		$instance->requestId = $this->requestId;
		return $instance;
	}
886165
protected function send(
        ResponseInterface $response,
        string $body): ResponseInterface
    {
        if (!$body) {
            $response = $this->sendErrorDocument($response);
        }
        unset($this->errorDocument);
        $response = $response->withHeader(
            Response::HEADER_CONTENT_LENGTH,
            (string) strlen($body));
        header(Response::PROTOCOL
             . $response->getProtocolVersion() . " "
             . $response->getStatusCode() . " "
             . $response->getReasonPhrase());
        foreach ($response->getHeaders() as $key => $value) {
            header($key . ": " . implode("; ", $value));
        }
        $response->getBody()->write($body);
        return $response;
    }
1334947
public function response($body = null): ResponseInterface
    {
        /* RFC2616 - 14.18 says all Responses need to have a Date */
        if (!$this->header->has('Date')) {
            $this->setDate(\DateTime::createFromFormat('U', (string) \time()));
        }

        if (($this->status >= 100 && $this->status < 200) || $this->status === 204 || $this->status === 304) {
            $body = null;
            $this->header->remove('Content-Type');
            $this->header->remove('Content-Length');
        } else {
            if ($this->header->has('Transfer-Encoding')) {
                $this->header->remove('Content-Length');
            }

            if ($this->request->method() === 'HEAD') {
                $body = null;
            }
        }

        if (!$this->version && 'HTTP/1.0' !== $this->request->server('SERVER_PROTOCOL')) {
            $this->version = '1.1';
        }

        // Check if we need to send extra expire info headers
        if ('1.0' === $this->version && false !== strpos($this->getHeaderLine('Cache-Control') ?? '', 'no-cache')) {
            $this->header->set('Pragma', 'no-cache');
            $this->header->set('Expires', -1);
        }

        // Checks if we need to remove Cache-Control for SSL encrypted downloads when using IE < 9.
        if (
            true === $this->request->secure() &&
            false !== \stripos($this->getHeaderLine('Content-Disposition') ?? '', 'attachment') &&
            \preg_match('/MSIE (.*?);/i', $this->request->header('User-Agent'), $match) === 1
        ) {
            if ((int) \preg_replace('/(MSIE )(.*?);/', '$2', $match[0]) < 9) {
                $this->header->remove('Cache-Control');
            }
        }

        $headers = $this->header->all();
        $this->cookie->inject($headers);

        return Factory::response($this->status, $body, $headers, $this->version, $this->reason);
    }
1115059
private function requestBodyMatchesExpectation(ServerRequestInterface $httpRequest, RequestConditions $expectedRequest)
    {
        $inputSource = $this->inputSourceLocator->locate('body');
        $matcher = $this->matcherLocator->locate(
            $expectedRequest->getBody()->getMatcher()->asString()
        );

        return $matcher->match(
            $inputSource->getValue($httpRequest),
            $expectedRequest->getBody()->getValue()->asString()
        );
    }
549764
public function retrieveResponse(OAuthUriInterface $endpoint, $requestBody, array $extraHeaders = [], $method = 'POST')
    {
        $request = new Request();
        $request
            ->setUri($endpoint->getAbsoluteUri())
            ->setMethod($method)
            ->getHeaders()->addHeaders($extraHeaders);
        if (is_array($requestBody)) {
            $request->getPost()->fromArray($requestBody);
        } else {
            $request->setContent($requestBody);
        }
        $response = $this->client->send($request);

        return $response->getBody();
    }