Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When body is blank and hitting POST request getting "Length Required" error 411 #670

Closed
warademilind opened this issue Jun 25, 2024 · 3 comments

Comments

@warademilind
Copy link

warademilind commented Jun 25, 2024

Below is log -

url:https://test.com/APIGateway/api/v1/TestSub
method:POST
**request:**
{
  "headers" : {
    "Authorization" : "Bearer dasd.dasd.dasdsd",
    "IPAdress" : "192.168.1.1",
    "BrowserSessionID" : "rerdfsd",
    "ServiceType" : "web",
    "Content-Type" : "application/json",
    "AuthToken" : "12333-FD7E-4834-AD3B-4234324"
  },
  "body" : { }
} 

**Response:**
{
  "status" : 411,
  "headers" : {
    "Date" : [ "Tue, 25 Jun 2024 16:45:10 GMT" ],
    "Server" : [ "Microsoft-HTTPAPI/2.0" ],
    "Content-Length" : [ "344" ],
    "Content-Type" : [ "text/html; charset=us-ascii" ],
    "Connection" : [ "close" ]
  },
  "rawBody" : "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\"http://www.w3.org/TR/html4/strict.dtd\">\r\n<HTML><HEAD><TITLE>Length Required</TITLE>\r\n<META HTTP-EQUIV=\"Content-Type\" Content=\"text/html; charset=us-ascii\"></HEAD><p>HTTP Error 411. The request must be chunked or have a content length.</p>\r\n</BODY></HTML>\r\n"
}

In Postman, same request works properly. Please do needful help. I am using zerocode-tdd.version - 1.3.35 and 1.3.43

@warademilind
Copy link
Author

@authorjapps , @santhoshTpixler can you help me here.

@warademilind
Copy link
Author

warademilind commented Jun 26, 2024

I have also tried with removing body part as shown in example (https://github.com/authorjapps/zerocode/wiki#empty-http-body-payload) but same issue persists-

url:https://test.com/APIGateway/api/v1/TestSub
method:POST
request:
{
  "headers" : {
  "Authorization" : "Bearer dasd.dasd.dasdsd",
  "IPAdress" : "192.168.1.1",
  "BrowserSessionID" : "rerdfsd",
  "ServiceType" : "web",
  "Content-Type" : "application/json",
  "AuthToken" : "12333-FD7E-4834-AD3B-4234324"
 }
}

@authorjapps
Copy link
Owner

HTTP Error 411. The request must be chunked or have a content length.

The error what you get is a response from the server. Your server is complaining that:

HTTP Error 411. The request must be chunked or have a content length.

So it could be it is expecting an additional header actually.
e.g.

"Content-Length" : "2048", 

Try the above and rerun, could potentially resolve this.

Warning

2048 or a different value? please check with your API provider for the correct value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants