Expectation Failed when trying to update twitter status

前端 未结 3 1003
清歌不尽
清歌不尽 2021-01-26 04:46

I can\'t seem to figure this one out. No matter what I do, I keep getting a \"417 Expectation failed\" error. Everywhere I\'ve looked says that I need to get rid of the Expect h

相关标签:
3条回答
  • 2021-01-26 05:21

    DotNetOpenAuth doesn't set or support Except100Continue directly. Would be nice if there is a property in the Channel class.

    Add this before your call to 'PrepareAuthorizedRequest':

        ((HttpWebRequest)WebRequest.Create
    (UpdateStatusEndpoint.Location)).ServicePoint.Expect100Continue = false;
    

    Except100Continue is set depending on the called URL. So you can set it before the connection is created. You may even set it globally in the config file.

      <system.net>
        <settings>
          <servicePointManager expect100Continue="false" />
        </settings>
      </system.net>
    
    0 讨论(0)
  • 2021-01-26 05:25

    LinqToTwitter is a Twitter client library that uses DotNetOpenAuth. I'll see about adding a message posting example to the DotNetOpenAuth core library for a future version.

    0 讨论(0)
  • 2021-01-26 05:30

    Set the Expectation to "expect:nothing" ..this is my code:

    var data = new Dictionary();

    data.Add("status", status);

    HttpWebRequest request = twitter.PrepareAuthorizedRequest(UpdateStatusEndpoint, accessToken, data);

    request.Expect = "expect:nothing";

    var response = twitter.Channel.WebRequestHandler.GetResponse(request); exception return XDocument.Load(XmlReader.Create(response.GetResponseReader()));

    it worked for me...

    0 讨论(0)
提交回复
热议问题