HomeSoftware Heritage

api: Return absolute URIs in JSON responses

Description

api: Return absolute URIs in JSON responses

Ensure that all URIs returned in JSON responses of the Web API are absolute (prefixed
with protocol and domains).

That commit consists in:

  • adding a request parameter to our custom django reverse function in order to build an abolute URI before returning it
  • providing the input HTTP requests as parameter to reverse in API endpoints implementation
  • centralizing all enrich functions adding URIs in API responses in the swh.web.api.utils module
  • modifying tests implementation to check all returned URIs are absolute
  • adding some new and missing tests related to these improvements
  • modifying enrich function tests to remove hardcoded data in favor of hypothesis

Closes T2154