1

I've been fiddling a POST request that isn't working. What I've found is that the content of the request is empty even though I believe I'm adding it correctly (even though there aren't any docs available that I can find).

var json = JsonConvert.SerializeObject(payload);

var client = new RestClient
{
    Authority = "",
    Credentials = OAuthCredentials.ForProtectedResource(Registration.ClientKey, 
        Registration.ClientSecret, 
        AuthorizationToken.Token, 
        AuthorizationToken.Secret),
    Method = WebMethod.Post,
    Path = url
};

var request = new RestRequest();
request.AddHeader("Accept", ContentType);
request.AddHeader("Content-Type", ContentType);
request.AddPostContent(Encoding.UTF8.GetBytes(json));

response = client.Request(request);

I'm not having any trouble with authorization. I just kept getting a 400 error. After capturing the request with Fiddler, I noticed that content-length was 0. What am I missing? Do I need to do something in addition to AddPostContent? When I check the request object right before executing, there is content in PostContent, but it's as if Hammock isn't adding it to the request. I am using the latest full nuget (not ClientProfile).

enter image description here

Jason Butera
  • 2,376
  • 3
  • 29
  • 46

0 Answers0