1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-17 08:55:57 +00:00

Add a third, simple, example for folder structuring as requested at https://github.com/kataras/iris/issues/748

One change to code base but it will be described at the next version:

Error Handlers (`app.OnErrorCode/OnAnyErrorCode`)  respect the `app.UseGlobal`'s middlewares now (not the `app.Use` for reasons we can all understand, hopefully).


Former-commit-id: ec97bbb04548f9932cf4d7b950be513b70747bcb
This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-10-01 16:29:25 +03:00
parent ba63031871
commit 38c6241055
16 changed files with 308 additions and 0 deletions

View File

@@ -364,6 +364,8 @@ type Context interface {
// | Various Request and Post Data |
// +------------------------------------------------------------+
// URLParam returns true if the url parameter exists, otherwise false.
URLParamExists(name string) bool
// URLParamDefault returns the get parameter from a request, if not found then "def" is returned.
URLParamDefault(name string, def string) string
// URLParam returns the get parameter from a request , if any.
@@ -1236,6 +1238,7 @@ func (ctx *context) ContentType(cType string) {
cType += "; charset=" + charset
}
}
ctx.writer.Header().Set(contentTypeHeaderKey, cType)
}
@@ -1273,6 +1276,16 @@ func (ctx *context) GetStatusCode() int {
// | Various Request and Post Data |
// +------------------------------------------------------------+
// URLParam returns true if the url parameter exists, otherwise false.
func (ctx *context) URLParamExists(name string) bool {
if q := ctx.request.URL.Query(); q != nil {
_, exists := q[name]
return exists
}
return false
}
// URLParamDefault returns the get parameter from a request, if not found then "def" is returned.
func (ctx *context) URLParamDefault(name string, def string) string {
v := ctx.request.URL.Query().Get(name)