Этот URL var url = 'http://localhost:9090/test-message '
не имеет запроса Get Method.
Вы можете попробовать Like this
function myFunction() {
var str = "http://localhost:9090/test-message";
var res = str.split("/");
res = res.reverse();
alert(res[0]); //text-message
}