Description
As defined in the docs/handler_plugins.md
document, there are three variables that are passed into all handlers: payload
, headers
, and config
. I have learned that it was a mistake to try and symbolize the payload and the headers as the symbolizations can be tricky and it is much better to just leave these as plain ruby hashes in JSON representation.
It still makes sense to keep the config options related to normalization for each of these (ex: downcase'ing and trimming whitespace) but the config options like symbolize_headers
and symbolize_payload
should be removed.
It is fine to keep the config
variable as a symbolized hash because we control it as it is a part of this project. We do not truly control the payload
and headers
inputs but we can almost always expect each to be a hash like structure but symbolizing them is too ambitious. Both should be a pure ruby hash (if we can make them so) and if they can be a hash, they should be valid JSON structures.
So accessing a certain header from a handler and a payload attribute should be doable like so:
# examples
puts payload["some_cool_value"] # => "foo"
puts header["x-custom-header"] # => "super/cool-header"
Documentation and tests should be updated to reflect these changes. The config_validator
and config_loader
should also be updated to reflect these changes.