public function getEndpointUrl($url)
    {
        $components = parse_url($url);

        if (isset($components['query'])) {
            parse_str($components['query'], $query);
            unset($query['url']);
            $components['query'] = http_build_query($query);
        }

        return $this->assembleUrl($components);
    }