Documentation
¶
Index ¶
- func AppendResourcesHandler(previous_handler http.Handler, opts *AppendResourcesOptions) http.Handler
- func RewriteHTMLHandler(previous_handler go_http.Handler, rewrite_func RewriteHTMLFunc) go_http.Handler
- func RewriteRequestHandler(next go_http.Handler, rewrite_func RewriteRequestFunc) go_http.Handler
- type AppendResourcesOptions
- type RewriteHTMLFunc
- type RewriteRequestFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendResourcesHandler ¶
func AppendResourcesHandler(previous_handler http.Handler, opts *AppendResourcesOptions) http.Handler
AppendResourcesHandler() creates a `RewriteHTMLFunc` callback function, configured by 'opts', and uses that callback function and 'previous_handler' to invoke the `RewriteHTMLHandler` function. All of this will cause the output of 'previous_handler' to be rewritten to append headers and data attributes defined in 'opts'.
func RewriteHTMLHandler ¶
func RewriteHTMLHandler(previous_handler go_http.Handler, rewrite_func RewriteHTMLFunc) go_http.Handler
RewriteHTMLHandler return a `net/http` middleware handle to alter the body of 'previous_handler' using 'rewrite_func'. Content is only altered if and when the "Content-Type" header (returned by 'previous_handler') is "text/html". If not the unaltered body is returned as-is.
func RewriteRequestHandler ¶
func RewriteRequestHandler(next go_http.Handler, rewrite_func RewriteRequestFunc) go_http.Handler
RewriteRequestHandler() creates a `net/http` middleware handler that invokes 'rewrite_func' with the current request to create a new or updated `http.Request` instance used to serve 'next'.
Types ¶
type AppendResourcesOptions ¶
type AppendResourcesOptions struct { // A list of JavaScript URIs to append to an HTML document's `<head>` element as `<script>` tags. JavaScript []string // A list of CSS URIs to append to an HTML document's `<head>` element as `<link rel="stylesheet">` tags. Stylesheets []string // A dictionary of key and value pairs to append to an HTML document's <body> element as `data-{KEY}="{VALUE}` attributes. DataAttributes map[string]string // AppendJavaScriptAtEOF is a boolean flag to append JavaScript markup at the end of an HTML document // rather than in the <head> HTML element. Default is false AppendJavaScriptAtEOF bool }
AppendResourcesOptions is a struct containing configuration options for the `AppendResourcesHandler` method.
type RewriteHTMLFunc ¶
RewriteHTMLFunc is custom callback function for altering the HTML content of 'node'