# File lib/openid/server.rb, line 769
      def encode_to_url(server_url)
        # Encode this request as a URL to GET.
        #
        # server_url:: The URL of the OpenID server to make this
        #              request of.
        if !@return_to
          raise NoReturnToError
        end

        # Imported from the alternate reality where these classes are
        # used in both the client and server code, so Requests are
        # Encodable too.  That's right, code imported from alternate
        # realities all for the love of you, id_res/user_setup_url.
        q = {'mode' => @mode,
             'identity' => @identity,
             'claimed_id' => @claimed_id,
             'return_to' => @return_to}

        if @trust_root
          if @message.is_openid1
            q['trust_root'] = @trust_root
          else
            q['realm'] = @trust_root
          end
        end

        if @assoc_handle
          q['assoc_handle'] = @assoc_handle
        end

        response = Message.new(@message.get_openid_namespace)
        response.update_args(@message.get_openid_namespace, q)
        return response.to_url(server_url)
      end