FriendsOfSymfony / FOSJsRoutingBundle

A pretty nice way to expose your Symfony routing to client applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Routing dump does not include port for local dev

lampelk opened this issue · comments

When dumping routes on local dev:

fos:js-routing:dump --format=json --target=public/js/routes.json

The json output does not include port if the web server is running with a port (e.g. 8080):

{
  "base_url": "",
  "routes": {
    "app_home": {
      "tokens": [["text", "\/home"]],
      "defaults": [],
      "requirements": [],
      "hosttokens": [],
      "methods": [],
      "schemes": []
    }
  },
  "prefix": "",
  "host": "localhost",
  "port": "",
  "scheme": "http",
  "locale": ""
}

Expected result:

"port": 8080

I found this issue when trying to generate absolute URLs:

Routing.generate('app_home', /* your params */, true)

Result:

http://localhost/home

Expected result:

http://localhost:8080/home

Environment:
php: 8.0.2
symfony: 6.0*
friendsofsymfony/jsrouting-bundle: 3.1.1

Related (maybe?): #391