You should be able to look up the endpoint in your app's url_map: http://librelist.com/browser//flask/2013/1/14/inverse-of-url-for/#b2f098ca589268cb39be4894fd376f6a
On Mon, Jan 26, 2015 at 8:14 AM, Max Edwards <[email protected]> wrote: > I have settled on the still hacky but less evil > current_app.test_client().options(PATH_TO_TEST). Hopefully this is much > more lightweight than doing a GET request! > > > On Monday, January 26, 2015 at 3:21:20 PM UTC, Max Edwards wrote: >> >> I have a requirement (to protect against an XSS vulnerability) to check >> if a URL path would be matched by one of our url rules. >> >> At the moment I'm doing it in a hacky way by using >> current_app.test_client().get(PATH_TO_TEST) and checking that the status >> code is not 404. Bit heavy weight because it forces the route to fully >> execute also including template rendering. >> >> Ideally I would be able to do something like current_app.path_is_valid(GET, >> PATH_TO_TEST) or current_app.get_route_function_for_path(GET, >> PATH_TO_TEST) >> >> Many thanks! >> > -- > You received this message because you are subscribed to the Google Groups > "pocoo-libs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/pocoo-libs. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "pocoo-libs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/pocoo-libs. For more options, visit https://groups.google.com/d/optout.
