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

How do I debug POST requests?


I’m new to the test rail API & using the C# “SDK”

Question: How do I debug/view any activity logs on the server to see if it even received my POST?

What works: GET requests
What doesn’t work: POST requests - they timeout after 30+ seconds

Steps to reproduce the problem I’m trying to figure out how to debug…

  • Environment: Unity3D version 5.2.3f1
  • Get the C# client from your site
  • Set up an instance of Gurock.TestRail.APIClient connecting to your email/apikey on
  • This GET will work:
public Dictionary<String, Object> getSuite(int suiteId)
  	return (Dictionary<String, Object>)apiClient.SendGet ("get_suite/" + suiteId);
  • This POST request will FAIL and time out in APIClient.SendRequest durring the response = (HttpWebResponse)request.GetResponse(); call:
public Dictionary<String, Object> addRun(int projectId, int suiteId, int caseId, string name, string description)
  	int[] case_array = new int[] {caseId};
  	var data = new Dictionary<string, object> {
  		{"name",        name},
  		{"description", description},
  		{"case_ids",    case_array},
  		{"suite_id",    suiteId },
  	var result = apiClient.SendPost ("add_run/" + projectId, data);
  	return (Dictionary<String, Object>)result;


Hi Jason,

If you are using a self-hosted installation of TestRail, you can simply enable debug logging and see if the requests actually reach TestRail:



So it turns out that using HttpWebRequest to make a POST request in Unity3D’s flavor of C# - is completely broken. Strangely, GET works fine.

The solution was to use the WWW class inplace of WebRequest


Thanks, Jason, and good to hear that it works now. We will keep this in mind for a future version of the binding, thanks again!