Dart request succeeding ... somehow? -
i'm developing dart application consume rest service i'm building. started writing out dart code perform ajax request login endpoint. however, when dart ajax request should fail, claims succeed.
i don't have services , running (and if did using wrong domain / port right now), code gives 200 ok httpresponse every time:
class playercontroller { const playercontroller(); static const string login_url = "login"; void login(string username, string password) { map<string, string> headers = {"content-type": "application/x-www-form-urlencoded"}; string body = "j_username=$username&j_password=$password&submit=login"; httprequest.request(login_url, method: "post", requestheaders: headers, senddata: body) .then((request) => processlogin(request, username)) .catcherror((e) => processloginerror(e)); } void processlogin(var whatisthis, string username) { query("#loginbutton").text = "logout"; //todo player set them } void processloginerror(var e) { print("total failure login because of $e"); } }
it hits processlogin method, , never hits processloginerror method. have idea why be? should performing ajax request in different way? (if couldn't guess, signing spring security).
i read somewhere file system requests succeed. dart somehow making file system request rather web request?
this because request completes successfully.
your request "login" call http://127.0.0.1:6521/[path_to_your_dart_file]/login
the server started dart when running in dartium (127.0.0.1:6521) seems answer every post request http 200 , empty response body.
if change method post get, fail expected.
as why server - don't know. have answered dart team.
Comments
Post a Comment