private function request(string $method, Request $request): Response
    {
        $request = $this->credentials->authenticate($request);

        $url = $request->url()->toString();
        $headers = $request->headers();
        $body = $request->body();

        $options = [
            'http' =>
                [
                    'method'        => $method,
                    'header'        => $this->prepareHeadersForStreamContext($headers),
                    'content'       => $body,
                    'ignore_errors' => true
                ]
        ];

        $context = stream_context_create($options);

        $responseBody = @file_get_contents(
            $url,
            false,
            $context
        );

        if ($responseBody === false) {
            throw new NchanException('Unable to connect to ' . $url . '.');
        }

        return HttpStreamWrapperResponse::fromResponse($http_response_header, $responseBody);
    }