What the API knows about the request besides who sent it: the language and currency to answer in, the hosts this install serves, and the base URL for absolute links.
Core's defaults are deliberately plain:
:languageis the install's primary language (PhoenixKit.Utils.Multilang.primary_language/0);:currencyisnil, because core does not depend on Billing. The e-commerce module fills it from its base currency;:hostsis the request host;:base_urlisscheme://host[:port]of the request.
A host app overrides any of :language, :currency and :hosts per
request (a multi-domain install maps the domain to a language and a
currency):
config :phoenix_kit, :api_request_context, {MyApp.ApiContext, :resolve}The function takes the Plug.Conn and returns a map with any of those three
keys. A key of the wrong type is ignored. A function that raises is logged
and the defaults are used, so a bug in the hook cannot take the API down.
The log names the hook, the exception module and the shape of a bad result,
never their values: the hook gets the whole connection, headers included.
Summary
Functions
Resolves the context of conn.
Types
Functions
@spec resolve(Plug.Conn.t()) :: t()
Resolves the context of conn.