Documentation ¶
Overview ¶
Code from https://github.com/erikdubbelboer/ringqueue
The MIT License (MIT)
Copyright (c) 2015 Erik Dubbelboer ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- Constants
- func GetDevServerURL() string
- func GetMimetype(filename string, data []byte) string
- func GetStartURL(userURL string) (string, error)
- func NewAssetFileServer(vfs fs.FS) http.Handler
- func ServeFile(rw http.ResponseWriter, filename string, blob []byte) error
- type AssetServer
- type BundledAssetServer
- type Middleware
- type Options
- type RuntimeHandler
Constants ¶
const ( HeaderHost = "Host" HeaderContentType = "Content-Type" HeaderContentLength = "Content-Length" HeaderUserAgent = "User-Agent" // TODO: Is this needed? HeaderCacheControl = "Cache-Control" HeaderUpgrade = "Upgrade" WailsUserAgentValue = "wails.io" )
Variables ¶
This section is empty.
Functions ¶
func GetDevServerURL ¶
func GetDevServerURL() string
func GetMimetype ¶
func GetStartURL ¶
Types ¶
type AssetServer ¶
type AssetServer struct {
// contains filtered or unexported fields
}
func NewAssetServer ¶
func NewAssetServer(options *Options) (*AssetServer, error)
func (*AssetServer) AttachServiceHandler ¶
func (a *AssetServer) AttachServiceHandler(prefix string, handler http.Handler)
func (*AssetServer) LogDetails ¶
func (a *AssetServer) LogDetails()
func (*AssetServer) ServeHTTP ¶
func (a *AssetServer) ServeHTTP(rw http.ResponseWriter, req *http.Request)
func (*AssetServer) ServeWebViewRequest ¶
func (a *AssetServer) ServeWebViewRequest(req webview.Request)
ServeWebViewRequest processes the HTTP Request asynchronously by faking a golang HTTP Server. The request will be finished with a StatusNotImplemented code if no handler has written to the response. The AssetServer takes ownership of the request and the caller mustn't close it or access it in any other way.
type BundledAssetServer ¶
type BundledAssetServer struct {
// contains filtered or unexported fields
}
func NewBundledAssetFileServer ¶
func NewBundledAssetFileServer(fs fs.FS) *BundledAssetServer
func (*BundledAssetServer) ServeHTTP ¶
func (b *BundledAssetServer) ServeHTTP(rw http.ResponseWriter, req *http.Request)
type Middleware ¶
Middleware defines a HTTP middleware that can be applied to the AssetServer. The handler passed as next is the next handler in the chain. One can decide to call the next handler or implement a specialized handling.
func ChainMiddleware ¶
func ChainMiddleware(middleware ...Middleware) Middleware
ChainMiddleware allows chaining multiple middlewares to one middleware.
type Options ¶
type Options struct { // Handler which serves all the content to the WebView. Handler http.Handler // Middleware is a HTTP Middleware which allows to hook into the AssetServer request chain. It allows to skip the default // request handler dynamically, e.g. implement specialized Routing etc. // The Middleware is called to build a new `http.Handler` used by the AssetSever and it also receives the default // handler used by the AssetServer as an argument. // // This middleware injects itself before any of Wails internal middlewares. // // If not defined, the default AssetServer request chain is executed. // // Multiple Middlewares can be chained together with: // ChainMiddleware(middleware ...Middleware) Middleware Middleware Middleware // Logger is the logger used by the AssetServer. If not defined, no logging will be done. Logger *slog.Logger }
Options defines the configuration of the AssetServer.
type RuntimeHandler ¶
type RuntimeHandler interface {
HandleRuntimeCall(w http.ResponseWriter, r *http.Request)
}