multiverse v2.0.0 Multiverse.Change behaviour
Provides behaviour for Multiverse API Changes.
Examples
defmodule ChangeAccountType do
@behaviour Multiverse.Change
def handle_request(%Plug.Conn{} = conn) do
# Mutate your request here
IO.inspect "GateName.mutate_request applied to request"
conn
end
def handle_response(%Plug.Conn{} = conn) do
# Mutate your response here
IO.inspect "GateName.mutate_response applied to response"
conn
end
end
Link to this section Summary
Functions
Macros that can be used if you want to omit either handle_request/1
or handle_response/1
callback in your change module
Checks if change is active on connection or version schema
Link to this section Functions
Macros that can be used if you want to omit either handle_request/1
or handle_response/1
callback in your change module.
Link to this function
active?(arg1, change)
active?( conn_or_version_schema :: Plug.Conn.t() | Multiverse.VersionSchema.t(), change :: module() ) :: boolean()
Checks if change is active on connection or version schema.
Link to this section Callbacks
Defines a request mutator.
This function will be called whenever Cowboy receives request.
Defines a response mutator.
This function will be called before Cowboy is dispatched response to a consumer.