1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-24 05:17:03 +00:00

add a Route#StaticTarget string to determinate if a specific route is handling static files, could be handly for 3rd party tools

Former-commit-id: 5befb73654c9499ce99a1f14257f85edb9bd7b52
This commit is contained in:
Gerasimos (Makis) Maropoulos
2019-06-15 16:59:32 +03:00
parent 164f24dec4
commit 7f9e33cabb
2 changed files with 24 additions and 7 deletions

View File

@@ -33,8 +33,21 @@ type Route struct {
// FormattedPath all dynamic named parameters (if any) replaced with %v,
// used by Application to validate param values of a Route based on its name.
FormattedPath string `json:"formattedPath"`
// StaticTarget if not empty, refers to the system (or virtual if embedded) directory
// that this route is serving static files/resources from
// or to a single static filename if this route created via `APIBuilder#Favicon`
// or to a `StaticContentTarget` type if this rotue created by `APIBuilder#StaticContent`.
//
// If a route is serving static files via `APIBuilder`
// there are two routes with the same dir/filename set to this field,
// one for "HEAD" and the other for the "GET" http method.
StaticTarget string
}
// StaticContentTarget used whenever a `Route#StaticTarget` refers to a raw []byte static content instead of a directory or a file.
const StaticContentTarget = "content"
// NewRoute returns a new route based on its method,
// subdomain, the path (unparsed or original),
// handlers and the macro container which all routes should share.