Closed safi-manar closed 5 years ago
@safi-manar it is not necessarily expected to have the same route served on both the admin and external interfaces (since generally admin routes are expected to start with /admin
to maintain conformance with the TwitterServer HTTP Admin interface -- so you'd have /ping
and /admin/ping
) hence this logic.
We are working to rewrite the embedded server logic and will take this case into consideration.
Thanks!
@safi-manar this was fixed in 4653992cf0d14481aa3faeae4071c873b6a81a5d. Please take look!
Very cool-- thank you! 🙂
Overloading a route in a controller yields different results when testing a running server vs in a FeatureTest.
Expected behavior
If I create two routes, such as
/ping
, one of which is on the admin port server (get("/ping", admin = true)
) and the other is not (get("/ping")
), I can run a local instance of the server, and run a GET request and depending on the port, it will route me to the correct controller. I expect to be able to replicate the same result in a FeatureTest.Actual behavior
However, if we try to test this in a FeatureTest using
routeToAdminServer
, we will always get routed to the private controller, even ifrouteToAdminServer = false
.I believe this is because in EmbeddedHttpServer, we have the following line:
so that even if
routeToAdminServer=false
, ifmatchesAdminRoute()
returns true, we will resolve the request usinghttpAdminClient
. Should the condiiton here berouteToAdminServer && matchesAdminRoute()
to match observed behavior on a real server?