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

How to does a POST request from UI Script


#1

Hi guys,

Im trying to execute a POST request from UI Script to my Flask server. From Postman post request its works, but from Testrail UI Script not.

Following my UI Script Ajax:

$.ajax({
url: ‘http://d60b09f2.ngrok.io/exec-testrun/’,
data: {‘test_run’:14},
type: ‘POST’,
contentType: “application/json; charset=utf-8”,
crossDomain: true,
dataType: ‘json’,
success: function() { alert(“Success”); },
error: function() { alert(‘Failed!’); },
});

And the output is:

POST http://d60b09f2.ngrok.io/exec-testrun/ 500 (INTERNAL SERVER ERROR)

This is the output of my web server:

[2018-10-10 13:07:37,058] ERROR in app: Exception on /exec-testrun/ [POST]
AttributeError: 'NoneType' object has no attribute 'get'

Why the JQuery call a GET request? And my POST request dont return anything

Someone know why happened this?