1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-17 18:07:01 +00:00

remove any trailing slash that may passed on StaticEmbeddedHandler (although all examples shows the correct way but you never know)

Former-commit-id: 50ab9ddb2e738b4061622ac9ebcfec30e0cdecfa
This commit is contained in:
Gerasimos Maropoulos
2018-03-16 12:38:13 +02:00
parent 87036fdb6c
commit 8cec6a6f9b
3 changed files with 16 additions and 2 deletions

View File

@@ -629,7 +629,7 @@ func (api *APIBuilder) StaticContent(reqPath string, cType string, content []byt
// StaticEmbedded used when files are distributed inside the app executable, using go-bindata mostly
// First parameter is the request path, the path which the files in the vdir will be served to, for example "/static"
// Second parameter is the (virtual) directory path, for example "./assets"
// Second parameter is the (virtual) directory path, for example "./assets" (no trailing slash),
// Third parameter is the Asset function
// Forth parameter is the AssetNames function.
//
@@ -646,6 +646,10 @@ func (api *APIBuilder) StaticEmbedded(requestPath string, vdir string, assetFn f
// it sends gzip response only, so the client must be aware that is expecting a gzip body
// (browsers and most modern browsers do that, so you can use it without fair).
//
// First parameter is the request path, the path which the files in the vdir will be served to, for example "/static"
// Second parameter is the (virtual) directory path, for example "./assets" (no trailing slash),
// Third parameter is the GzipAsset function
// Forth parameter is the GzipAssetNames function.
//
// Example: https://github.com/kataras/iris/tree/master/_examples/file-server/embedding-gziped-files-into-app
func (api *APIBuilder) StaticEmbeddedGzip(requestPath string, vdir string, gzipAssetFn func(name string) ([]byte, error), gzipNamesFn func() []string) *Route {