Closed john-westcott-iv closed 1 month ago
@john-westcott-iv not sure if I asked this before, but would this be a breaking change for services (e.g. EDA) using DAB?
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
100.0% Coverage on New Code
0.0% Duplication on New Code
AAP-26819
We somewhat arbitrarily used DRF reverse along with Django reverse. The difference is that Django reverse produces a relative URL and DRF reverse looks at the request and returns a fully qualified url.
This PR adds two functions:
get_fully_qualifed_url
andget_relative_url
toansible_base.lib.utils.response
. This PR also converts all references to bothreverse
methods to our new method.The
get_fully_qualified_url
will look for a setting calledFRONT_END_URL
and use that as theprotocol://server:port
portion of the URL if defined. If undefined it will allow DRF to attempt to do its normal reverse.In most places in the API we should be using relative URLs. Hover, if we need a fully qualified URL for any reason we should attempt to use
get_fully_qualified_url
. These functions both take a view name and *args and **kwargs similar to the existing reverse methods.In addition to being more explicit, this will help us to have a common method and seeing for constructing fully qualified URLs.