Expand description
hyperlane-macros
A comprehensive collection of procedural macros for building HTTP servers with enhanced functionality.
Macros§
- context
- Generates a context reference binding statement.
Attribute Macros§
- attribute
- Extracts a specific attribute value into a variable with panic on missing value.
- attributes
- Extracts all attributes into a ThreadSafeAttributeStore variable.
- clear_
response_ headers - Clears all response headers.
- closed
- Handles closed connection scenarios.
- epilogue_
hooks - Executes multiple specified functions after the main handler function.
- epilogue_
macros - Injects a list of macros after the decorated function.
- filter
- Filters requests based on a boolean condition.
- flush
- Flushes the response stream after function execution.
- host
- Restricts function execution to requests with a specific host.
- hyperlane
- Creates a new instance of a specified type with a given variable name.
- import
- Imports a path anonymously at the top of the decorated function body.
- is_
connect_ method - Restricts function execution to HTTP CONNECT requests only.
- is_
delete_ method - Restricts function execution to HTTP DELETE requests only.
- is_
get_ method - Restricts function execution to HTTP GET requests only.
- is_
h2c_ upgrade_ type - Restricts function execution to HTTP/2 Cleartext (is_h2c_upgrade_type) requests only.
- is_
head_ method - Restricts function execution to HTTP HEAD requests only.
- is_
http0_ 9_ version - Restricts function execution to HTTP/0.9 requests only.
- is_
http1_ 0_ version - Restricts function execution to HTTP/1.0 requests only.
- is_
http1_ 1_ or_ higher_ version - Restricts function execution to HTTP/1.1 or higher protocol versions.
- is_
http1_ 1_ version - Restricts function execution to HTTP/1.1 requests only.
- is_
http2_ version - Restricts function execution to HTTP/2 requests only.
- is_
http3_ version - Restricts function execution to HTTP/3 requests only.
- is_
http_ version - Restricts function execution to standard HTTP requests only.
- is_
options_ method - Restricts function execution to HTTP OPTIONS requests only.
- is_
patch_ method - Restricts function execution to HTTP PATCH requests only.
- is_
post_ method - Restricts function execution to HTTP POST requests only.
- is_
put_ method - Restricts function execution to HTTP PUT requests only.
- is_
tls_ upgrade_ type - Restricts function execution to TLS-encrypted requests only.
- is_
trace_ method - Restricts function execution to HTTP TRACE requests only.
- is_
unknown_ method - Restricts function execution to unknown HTTP methods only.
- is_
unknown_ upgrade_ type - Restricts function execution to requests with unknown protocol upgrade types only.
- is_
unknown_ version - Restricts function execution to requests with unknown HTTP versions only.
- is_
ws_ upgrade_ type - Restricts function execution to WebSocket upgrade requests only.
- methods
- Allows function to handle multiple HTTP methods.
- prologue_
hooks - Executes multiple specified functions before the main handler function.
- prologue_
macros - Injects a list of macros before the decorated function.
- referer
- Restricts function execution to requests with a specific referer.
- reject
- Rejects requests based on a boolean condition.
- reject_
host - Reject requests that have no host header.
- reject_
referer - Reject requests that have a specific referer header.
- request_
body - Extracts the raw request body into a specified variable.
- request_
body_ json - Parses the request body as JSON into a specified variable and type with panic on parsing failure.
- request_
body_ json_ result - Parses the request body as JSON into a specified variable and type with panic on parsing failure.
- request_
cookie - Extracts a specific cookie value or all cookies into a variable with panic on missing value.
- request_
cookies - Extracts all cookies as a raw string into a variable.
- request_
error - Registers a function as a request error hook.
- request_
error_ data - Extracts request error data into a variable with panic on missing value.
- request_
header - Extracts a specific HTTP request header into a variable with panic on missing value.
- request_
headers - Extracts all HTTP request headers into a collection variable.
- request_
middleware - Registers a function as a request middleware.
- request_
path - Extracts the HTTP request path into a variable.
- request_
query - Extracts a specific request query parameter into a variable with panic on missing value.
- request_
querys - Extracts all request query parameters into a RequestQuerys variable.
- request_
version - Extracts the HTTP request version into a variable.
- response_
body - Sets the HTTP response body.
- response_
header - Sets or replaces a specific HTTP response header.
- response_
middleware - Registers a function as a response middleware.
- response_
reason_ phrase - Sets the HTTP reason phrase for the response.
- response_
status_ code - Sets the HTTP status code for the response.
- response_
version - Sets the HTTP response version.
- route
- Registers a function as a route handler.
- route_
param - Extracts a specific route parameter into a variable with panic on missing value.
- route_
params - Extracts all route parameters into a collection variable.
- send
- Automatically sends data via stream after function execution.
- task_
panic - Registers a function as a panic hook.
- task_
panic_ data - Extracts panic data into a variable with panic on missing value.
- try_
flush - Tries to flush the response stream after function execution.
- try_
get_ attribute - Extracts a specific attribute value into a variable wrapped in Option type.
- try_
get_ http_ request - Wraps function body with HTTP stream processing.
- try_
get_ request_ cookie - Extracts a specific cookie value or all cookies into a variable wrapped in Option type.
- try_
get_ request_ error_ data - Extracts request error data into a variable wrapped in Option type.
- try_
get_ request_ header - Extracts a specific HTTP request header into a variable wrapped in Option type.
- try_
get_ request_ query - Extracts a specific request query parameter into a variable wrapped in Option type.
- try_
get_ route_ param - Extracts a specific route parameter into a variable wrapped in Option type.
- try_
get_ task_ panic_ data - Extracts panic data into a variable wrapped in Option type.
- try_
get_ websocket_ request - Wraps function body with WebSocket stream processing.
- try_
send - Automatically tries to send data via stream after function execution.