Sunday, 15 April 2012

Redirect http server request in Dart, but uri.host is blank -



Redirect http server request in Dart, but uri.host is blank -

i've got:

server.listen((httprequest request) { print(request.uri.tostring()); if (request.uri.host == "woven.app") { request.response.redirect(new uri(scheme: 'http', host: 'woven.co', path: request.uri.path, fragment: request.uri.fragment)); } ...

but line 2 returns blank. according notes request.uri:

* returns host part of authorization component. * * returns empty string if there no authorization component , * hence no host.

update: case locally , on server, tested chrome.

this returns hostname:

request.headers.host

why work whereas request.uri.host not?

dart

No comments:

Post a Comment