Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WrappingHTTPHandler ¶
If the sub-http.Handler returns HTML that is not a complete document (with opening and closing "<html>...</html>" HTML elements) then WrappingHTTPHandler wraps it.
It also infers what the "<title>...</title>" should be.
So, for example, if the sub-http.Handler returns a "Content-Type" with a media-type of "text/html" and the body is:
<div>What is this?</div>
Then WrappingHTTPHandler with transform that into:
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /> </head> <body> <main> <div>What is this?</div></main> </body> </html>
Or, for example, if the sub-http.Handler returns a "Content-Type" with a media-type of "text/html" and the body is:
<div> <h1>Hey!</h1> <p> What is this? </p> </div>
Then WrappingHTTPHandler with transform that into:
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /> <title>Hey!</title> </head> <body> <main> <div> <h1>Hey!</h1> <p> What is this? </p> </div> </body> </html>
func (WrappingHTTPHandler) ServeHTTP ¶
func (receiver WrappingHTTPHandler) ServeHTTP(responseWriter http.ResponseWriter, request *http.Request)
Click to show internal directories.
Click to hide internal directories.