FOSJsRoutingBundle icon indicating copy to clipboard operation
FOSJsRoutingBundle copied to clipboard

Routing dump does not include port for local dev

Open lampelk opened this issue 3 years ago • 0 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

lampelk avatar Jun 01 '22 18:06 lampelk