You need to sign in to do that
Don't have an account?
Sinow
Status=Length Required, StatusCode=411
I spend one day and could not fix this problem. when I run these code below in it throw the error: Status=Length Required, StatusCode=411, Please help me to take a look at it. Thanks very very much.
the code is:
String endpoint = 'http://www.websequencediagrams.com/index.php?'; String httpMethod = 'POST'; String paramStyle = 'style=earth'; String paramMessage = '&message=test'; HttpRequest request = new HttpRequest(); request.setEndpoint(endpoint + paramStyle + paramMessage); request.setMethod(httpMethod); request.setTimeOut(6000); request.setHeader('Charset', 'UTF-8'); request.setHeader('Content-Length', '-1'); request.setHeader('Content-Type', 'text/plain'); HttpResponse response = new Http().send(request); if(response.getStatusCode() >= 200 && response.getStatusCode() < 400) { system.debug(response.getBody()); } else { system.debug(response.getBody()); }
the bug is:
<P> Some aspect of the HTTP Request is invalid. Possible problems: <UL> <LI>Missing or unknown request method <LI>Missing URL <LI>Missing HTTP Identifier (HTTP/1.0) <LI>Request is too large <LI>Content-Length missing for POST or PUT requests <LI>Illegal character in hostname; underscores are not allowed </UL>
Remove this line
it also throw 411 error when remove this line.
please refer the below code:
Enjoy My Dost...!!!!