4

Very similarly to the Expect Continue problem C# described here, HTTP POST Returns Error: 417 "Expectation Failed.", I was getting an "Expectation Failed" error from the server I was trying to POST to with a HttpPost object in Android.

Community
  • 1
  • 1
Ivar Vong
  • 201
  • 2
  • 7

1 Answers1

16

The equivalent fix to prevent the request from using "expect continue" seems to be this:

httpPostInstance.getParams().setParameter(
    CoreProtocolPNames.USE_EXPECT_CONTINUE,
    Boolean.FALSE);

I found this at http://hc.apache.org/httpcomponents-client-ga/tutorial/html/fundamentals.html under 1.6.1.

Emre Yazici
  • 10,136
  • 6
  • 48
  • 55
Ivar Vong
  • 201
  • 2
  • 7