danielcrenna/hammock — Issue #42: Invalid Signature when adding AddField
Author: ferower
Created: 2011-10-10 19:39:49+00:00
State: open

I am wondering why if I add the AddField in the request it yields an invalid signature.

RestClient client = new RestClient()
{
HasElevatedPermissions = true,
Authority = "http://xxx.xxxxxx.com/v1",
Credentials = new OAuthCredentials()
{
Type = OAuthType.ProtectedResource,
ConsumerKey = consumerKey,
ConsumerSecret = sharedSecret,
Token = accessToken,
TokenSecret = tokenSecret,
SignatureMethod = OAuthSignatureMethod.HmacSha1,
ParameterHandling = OAuthParameterHandling.UrlOrPostParameters,
Version = "1.0"
},
};

RestRequest picRequest = new RestRequest()
{
Path = user + "/pics",
Method = WebMethod.Post

};

picRequest.AddFile("media", "filename.jpg", App.CapturedImage, "image/jpeg", "file");
picRequest.AddField("data", prepareJsonData("WP7 Test Upload", "", "", "1", "", "", "", ""));
client.BeginRequest(picRequest, new RestCallback(latCallback));

When Adding
picRequest.AddField("data", prepareJsonData("WP7 Test Upload", "", "", "1", "", "", "", ""));
To the code it gives an invalid signature but ommitting this line of code will post the picture. This json data is needed in the post so can guys is there any problem with my code or is it an issue within the Hammock Code? Thanks