HomeSoftware Heritage

api/async: add support for content negotiation

Description

api/async: add support for content negotiation

For the content negotiation to work, we expect handler functions to
return an aiohttp_utils.Response object instead of an aiohttp.Response one
so we can handle the serialization in the "main" middleware (error_middleware,
which should probably be renamed).

swh.core.api.asynchronous.encode_data_server() can still be used; it will
produce a correct Response object if negotitation is in use.

It should still work with server handler implementations that do
produce aiohttp.Response objects, but without the content negotitation
feature available then.

This adds a dependency on the aiohttp_utils python package.

Details

Provenance
douarddaAuthored on Jul 1 2019, 10:19 AM
douarddaPushed on Jul 15 2019, 3:53 PM
Differential Revision
D1688: api/async: add support for content negotiation
Parents
rDCORE13c18d781628: api: properly use deprecated for class renamings
Branches
Unknown
Tags
Unknown
References
tag: v0.0.65, tag: v0.0.64
Build Status
Buildable 6873
Build 9630: test-and-build