Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

Max Post Size Exceeded error message


Hi - I have had this error message a few times in the last 2 days.
It has been given when moving test cases, and selecting the next test in my test run.
Do you know the cause of it please?


Hello Clair,

Thanks for your posting. This message is generated by TestRail when it receives an invalid POST request by a client (e.g. browser). We’ve only seen it so far in combination with HTTP clients that try to interact with TestRail’s API (and submitted the request in a invalid/incomplete format). Which browser and version do you use?



Hi Tobias,

Thank you for getting back to me.
I am using TestRail v2.5.1.1626, with Internet Explorer 9 - version 9.0.8112.16421 (Update Version 9.0.8).
Once I get the message I OK it, and repeat the request, and it is successful.
Thank you


Thanks for the additional details, Clair. Do you know if your browser is configured to use a proxy or similar? Also, would you have the option to use a different browser to check if this only occurs with Internet Explorer?



I am getting this error now after using the API for months without issues. Nothing has changed with how we make the requests either. The request looks like

POST http://server/testrail/index.php?/miniapi/add_result/10833&key=MyKey HTTP/1.1
Accept: application/json
Host: server
Content-Length: 47
Expect: 100-continue
Connection: Keep-Alive

status_id=5&comment=Unit Test&version=Unit Test

Results in

{“result”:false,“error”:“Maximum POST size was exceeded.”}

We are using TestRail v2.5.1.1626

I tried updating to the latest API also and that didn’t resolve the issue. Is there a way to see what the actual error is that is occurring? Using the website to add test results still works.



Thanks for your posting. This error is returned when TestRail sees a POST request with an empty (or not correctly formatted) body (i.e. an empty $_POST array in PHP) but with the Content-Length > 0. This usually indicates that the POST request is larger than PHP allows (max_post_size) but this may also happen with invalid requests.

Which tool/library do you use for your HTTP requests? Can you post a code snippet for this? Thanks and I look forward to your reply.



The code I use to make the requests hasn’t changed in 6 months and all of the sudden it stopped working one day, which is why I’m puzzled why it stopped working.

The PHP configuration hasn’t changed, and still has a post size of 8M.
; Maximum size of POST data that PHP will accept.
post_max_size = 8M

I just tried upgrading to the latest TestRail 2.6 version and I still get the same error.

The log in the admin section reports:

[ControllerException] Maximum POST size was exceeded.

File: C:\inetpub\wwwroot\testrail\sys\helpers\ex.php
Line: 23
Status Code: 500
Host: server
Uri: /testrail/index.php?/miniapi/add_result/10833&key=MyKeyHere(POST)

PHP: 5.3.8
Server: Windows NT 6.1 build 7601 (Windows Server 2008 R2 Enterprise Edition Service Pack 1) i586

at ex::raise (ex.php:23)
at ex::raise (controller.php:201)
at Controller::_raise (controller.php:51)
at Controller->_check_for_post_size (controller.php:28)
at Controller->_init (base.php:26)
at BaseController->_init (application.php:17)
at ApplicationController->_init (public.php:15)
at PublicController->_init (miniapi.php:13)
at Miniapi_controller->_init (gizmo.php:107)
at require_once (index.php:106)

If I actually change the content length, Fiddler2 starts to detect HTTP protocol errors. My actual post requests don’t result in any errors.

The C# code I’ve been using is:

[code]public SubmitResultResponse SubmitTestResult(int testResultId, TestStatus testStatus, string comment = “”, string version = “”)
var response = GetPOSTResponse(
string.Format("{0}add_result/{1}&key={2}", BaseURI, testResultId, APIKey),//Build the URL
string.Format(“status_id={0}&comment={1}&version={2}”, (int)testStatus, comment, version));//Build the POST data
return new SubmitResultResponse(response);

private static string GetPOSTResponse(string url, string postData)
return GetResponse(url, postData, “POST”);

private static string GetResponse(string url, string postData, string method)
        var request = WebRequest.Create(url);
        // Set the Method property of the request to POST.
        request.Method = method;
        // Set the ContentType property of the WebRequest.
        (request as HttpWebRequest).Accept = "application/json";
        Stream dataStream;
        if (method == "POST")
            byte[] byteArray = Encoding.UTF8.GetBytes(postData);
            // Set the ContentLength property of the WebRequest.
            request.ContentLength = byteArray.Length;
            // Get the request stream.
            dataStream = request.GetRequestStream();
            // Write the data to the request stream.
            dataStream.Write(byteArray, 0, byteArray.Length);
            // Close the Stream object.
        // Get the response.
        var response = request.GetResponse();
        // Get the stream containing content returned by the server.
        dataStream = response.GetResponseStream();
        // Open the stream using a StreamReader for easy access.
        if (dataStream != null)
            var reader = new StreamReader(dataStream);
            // Read the content.
            var responseFromServer = reader.ReadToEnd();
            //Close the connections
            return responseFromServer;
        return null;

public enum TestStatus
Passed = 1,
Blocked = 2,
Retest = 4,
Failed = 5


I tried making the request from curl and noticed that it added the Content-Type header, which was not appearing in my requests.

I added the line of code
request.ContentType = “application/x-www-form-urlencoded”;
when setting up my request and now it works correctly again.

So it was the absence of the Content-Type header that was causing the issue.



Thanks for the update and great to hear that it works now. We will keep the Content-Type header in mind when we see this behavior again. I guess that PHP ignores the POST arguments when this header is not set as it doesn’t have any information about the body format (we may add an additional check for this to TestRail to issue a better error message in this case).

Thanks again and just let me know in case you have any further questions.