Formatter middleware now respects provides annotation for routes and
uses it both as default and as a restriction on allowed response
content types.
This makes it possible to for ex. output binary blobs on specific paths,
while keeping the rest of the paths as structured data.
To acheive this, we needed to make the following changes:
Raisin::Middleware::Formatter is now aware of the running Raisin app
(via raisin attribute)
::Formatter->negotiate_format method has gained a new parmeter to
allow for picking the proper default when provides is configured and
Accept: */* header is sent
Formatter middleware now respects
provides
annotation for routes and uses it both as default and as a restriction on allowed response content types.This makes it possible to for ex. output binary blobs on specific paths, while keeping the rest of the paths as structured data.
To acheive this, we needed to make the following changes:
Raisin::Middleware::Formatter
is now aware of the running Raisin app (viaraisin
attribute)::Formatter->negotiate_format
method has gained a new parmeter to allow for picking the proper default whenprovides
is configured andAccept: */*
header is sent