You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#@paramenv[Hash] A modifed Rack environment that contains a lot of context about the request
20
21
#@paramconfig[Hash] Endpoint configuration
21
22
#@return[Hash] Response data
22
-
defcall(payload:, headers:, config:)
23
+
defcall(payload:, headers:, env:, config:)
23
24
return {
24
25
status:"success"
25
26
}
@@ -99,6 +100,34 @@ It should be noted that the `headers` parameter is a Hash with **string keys** (
99
100
100
101
You can disable header normalization by either setting the environment variable `HOOKS_NORMALIZE_HEADERS` to `false` or by setting the `normalize_headers` option to `false` in the global configuration file.
101
102
103
+
### `env` Parameter
104
+
105
+
The `env` parameter is a Hash that contains a modified Rack environment. It provides a lot of context about the request, including information about the request method, path, query parameters, and more. This can be useful for debugging or for accessing additional request information. It is considered *everything plus the kitchen sink* that you might need to know about the request.
106
+
107
+
Here is a partial example of what the `env` parameter might look like:
For the complete list of available keys in the `env` parameter, you can refer to the source code at [`lib/hooks/app/rack_env_builder.rb`](../lib/hooks/app/rack_env_builder.rb).
130
+
102
131
### `config` Parameter
103
132
104
133
The `config` parameter is a Hash (symbolized) that contains the endpoint configuration. This can include any additional settings or parameters that you want to use in your handler. Most of the time, this won't be used, but sometimes endpoint configs add `opts` that can be useful for the handler.
@@ -123,9 +152,10 @@ class Example < Hooks::Plugins::Handlers::Base
123
152
#
124
153
#@parampayload[Hash, String] Webhook payload
125
154
#@paramheaders[Hash<String, String>] HTTP headers
155
+
#@paramenv[Hash] A modified Rack environment that contains a lot of context about the request
0 commit comments