Jim Reineri
Jim Reineri

Reputation: 2980

How do I make Hammock issue an HTTP GET

I have a Silverlight 4.0 application that is making RESTful calls to an MVC3 application using the Hammock API on the client to issue the RESTful service codes.

The problem is that whether the request.Method is set to WebMethod.Get or WebMethod.Post, the request that is sent is a POST. What am I doing wrong?

private IAsyncResult GetServerList()
{
    var callback = new RestCallback((restRequest, restResponse, userState) =>
                {
                    // There is some working callback code here.  Excluded for clarity.
                }
            );

    var request = new RestRequest();
    request.Method = WebMethod.Get;
    request.Path = "ServerList";
    return _restClient.BeginRequest(request, callback);
}

Upvotes: 0

Views: 378

Answers (1)

codingintherain
codingintherain

Reputation: 263

Try setting the request type on RestClient.

var restClient = new RestClient
        {
            Method = WebMethod.Get
        };

Or from your example:

private IAsyncResult GetServerList()
{
    var callback = new RestCallback((restRequest, restResponse, userState) =>
            {
                // There is some working callback code here.  Excluded for clarity.
            }
    );

    var request = new RestRequest();
    request.Path = "ServerList";

    _restClient.Method = WebMethod.Get;
    return _restClient.BeginRequest(request, callback);
}

Upvotes: 0

Related Questions