Permalink
Browse files

Nothing special here, read HISTORY.md

  • Loading branch information...
1 parent 4e9f847 commit 1d055f60bfdba02e9d8174e65c7d3330e403447a @kataras committed Jan 10, 2017
Showing with 109 additions and 137 deletions.
  1. +5 −5 HISTORY.md
  2. +2 −2 README.md
  3. +4 −4 configuration.go
  4. +5 −5 context.go
  5. +1 −1 context_test.go
  6. +4 −4 http.go
  7. +5 −70 http_test.go
  8. +38 −37 iris.go
  9. +6 −4 plugin.go
  10. +2 −2 plugin_test.go
  11. +35 −1 response_writer_test.go
  12. +2 −2 transactions.go
View
@@ -375,7 +375,7 @@ Downloads the [basic](https://github.com/iris-contrib/examples/tree/master/AIO_
**outline**
```go
-// StaticEmbedded used when files are distrubuted inside the app executable, using go-bindata mostly
+// 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(second parameter) will be served to, for example "/static"
// Second parameter is the (virtual) directory path, for example "./assets"
// Third parameter is the Asset function
@@ -832,7 +832,7 @@ iris.Set(iris.OptionDisableBanner(true))
**List** of all available options:
```go
-// OptionDisablePathCorrection corrects and redirects the requested path to the registed path
+// OptionDisablePathCorrection corrects and redirects the requested path to the registered path
// for example, if /home/ path is requested but no handler for this Route found,
// then the Router checks if /home handler exists, if yes,
// (permant)redirects the client to the correct path /home
@@ -880,7 +880,7 @@ OptionTimeFormat(val string)
OptionCharset(val string)
// OptionGzip enables gzip compression on your Render actions, this includes any type of render, templates and pure/raw content
-// If you don't want to enable it globaly, you could just use the third parameter on context.Render("myfileOrResponse", structBinding{}, iris.RenderOptions{"gzip": true})
+// If you don't want to enable it globally, you could just use the third parameter on context.Render("myfileOrResponse", structBinding{}, iris.RenderOptions{"gzip": true})
// Default is false
OptionGzip(val bool)
@@ -1124,7 +1124,7 @@ Notes: if you compare it with previous releases (13+ versions before v3 stable),
If you're **willing to donate** click [here](DONATIONS.md)!
-- `iris.Config.Gzip`, enables gzip compression on your Render actions, this includes any type of render, templates and pure/raw content. If you don't want to enable it globaly, you could just use the third parameter on context.Render("myfileOrResponse", structBinding{}, iris.RenderOptions{"gzip": true}). It defaults to false
+- `iris.Config.Gzip`, enables gzip compression on your Render actions, this includes any type of render, templates and pure/raw content. If you don't want to enable it globally, you could just use the third parameter on context.Render("myfileOrResponse", structBinding{}, iris.RenderOptions{"gzip": true}). It defaults to false
- **Added** `config.Server.Name` as requested
@@ -1551,7 +1551,7 @@ OnDisconnect(func(){})
We have some base-config's changed, these configs which are defaulted to true renamed to 'Disable+$oldName'
```go
- // DisablePathCorrection corrects and redirects the requested path to the registed path
+ // DisablePathCorrection corrects and redirects the requested path to the registered path
// for example, if /home/ path is requested but no handler for this Route found,
// then the Router checks if /home handler exists, if yes,
// (permant)redirects the client to the correct path /home
View
@@ -378,7 +378,7 @@ Serve files or directories, use the correct for your case, if you don't know whi
// you can declare your own path if you have more than one favicon (desktop, mobile and so on)
//
// this func will add a route for you which will static serve the /yuorpath/yourfile.ico to the /yourfile.ico (nothing special that you can't handle by yourself)
-// Note that you have to call it on every favicon you have to serve automatically (dekstop, mobile and so on)
+// Note that you have to call it on every favicon you have to serve automatically (desktop, mobile and so on)
//
// panics on error
Favicon(favPath string, requestPath ...string) RouteNameFunc
@@ -393,7 +393,7 @@ StaticHandler(reqPath string, systemPath string, showList bool, enableGzip bool)
// second parameter is the system directory (string)
StaticWeb(reqPath string, systemPath string) RouteNameFunc
-// StaticEmbedded used when files are distrubuted inside the app executable, using go-bindata mostly
+// 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"
// Third parameter is the Asset function
View
@@ -119,7 +119,7 @@ type Configuration struct {
// Default is false
CheckForUpdatesSync bool
- // DisablePathCorrection corrects and redirects the requested path to the registed path
+ // DisablePathCorrection corrects and redirects the requested path to the registered path
// for example, if /home/ path is requested but no handler for this Route found,
// then the Router checks if /home handler exists, if yes,
// (permant)redirects the client to the correct path /home
@@ -177,7 +177,7 @@ type Configuration struct {
Charset string
// Gzip enables gzip compression on your Render actions, this includes any type of render, templates and pure/raw content
- // If you don't want to enable it globaly, you could just use the third parameter on context.Render("myfileOrResponse", structBinding{}, iris.RenderOptions{"gzip": true})
+ // If you don't want to enable it globally, you could just use the third parameter on context.Render("myfileOrResponse", structBinding{}, iris.RenderOptions{"gzip": true})
// Defaults to false
Gzip bool
@@ -312,7 +312,7 @@ var (
}
}
- // OptionDisablePathCorrection corrects and redirects the requested path to the registed path
+ // OptionDisablePathCorrection corrects and redirects the requested path to the registered path
// for example, if /home/ path is requested but no handler for this Route found,
// then the Router checks if /home handler exists, if yes,
// (permant)redirects the client to the correct path /home
@@ -401,7 +401,7 @@ var (
}
// OptionGzip enables gzip compression on your Render actions, this includes any type of render, templates and pure/raw content
- // If you don't want to enable it globaly, you could just use the third parameter on context.Render("myfileOrResponse", structBinding{}, iris.RenderOptions{"gzip": true})
+ // If you don't want to enable it globally, you could just use the third parameter on context.Render("myfileOrResponse", structBinding{}, iris.RenderOptions{"gzip": true})
// Default is false
OptionGzip = func(val bool) OptionSet {
return func(c *Configuration) {
View
@@ -64,7 +64,7 @@ const (
// CacheControl "Cache-Control"
cacheControl = "Cache-Control"
- // stopExecutionPosition used inside the Context, is the number which shows us that the context's middleware manualy stop the execution
+ // stopExecutionPosition used inside the Context, is the number which shows us that the context's middleware manually stop the execution
stopExecutionPosition = 255
)
@@ -132,7 +132,7 @@ type (
Request *http.Request
values requestValues
framework *Framework
- //keep track all registed middleware (handlers)
+ //keep track all registered middleware (handlers)
Middleware Middleware // exported because is useful for debugging
session sessions.Session
// Pos is the position number of the Context, look .Next to understand
@@ -313,7 +313,7 @@ func (ctx *Context) URLParam(key string) string {
return ctx.Request.URL.Query().Get(key)
}
-// URLParams returns a map of GET query parameters seperated by comma if more than one
+// URLParams returns a map of GET query parameters separated by comma if more than one
// it returns an empty map if nothing founds
func (ctx *Context) URLParams() map[string]string {
values := map[string]string{}
@@ -1192,7 +1192,7 @@ func (ctx *Context) RemoveCookie(name string) {
c.Expires = exp
c.MaxAge = -1
ctx.SetCookie(c)
- // delete request's cookie also, which is temporarly available
+ // delete request's cookie also, which is temporary available
ctx.Request.Header.Set("Cookie", "")
}
@@ -1292,7 +1292,7 @@ var errTransactionInterrupted = errors.New("Transaction Interrupted, recovery fr
// BeginTransaction starts a scoped transaction.
//
// Can't say a lot here because it will take more than 200 lines to write about.
-// You can search third-party articles or books on how Business Transaction works (it's quite simple, especialy here).
+// You can search third-party articles or books on how Business Transaction works (it's quite simple, especially here).
//
// Note that this is unique and new
// (=I haver never seen any other examples or code in Golang on this subject, so far, as with the most of iris features...)
View
@@ -684,7 +684,7 @@ func TestTransactions(t *testing.T) {
// OPTIONAl STEP:
// but useful if we want to post back an error message to the client if the transaction failed.
- // if the reason is empty then the transaction completed succesfuly,
+ // if the reason is empty then the transaction completed successfully,
// otherwise we rollback the whole response body and cookies and everything lives inside the transaction.Request.
t.Complete(err)
}
View
@@ -697,7 +697,7 @@ type (
Path() string
// SetPath changes/sets the path for this route
SetPath(string)
- // Middleware returns the slice of Handler([]Handler) registed to this route
+ // Middleware returns the slice of Handler([]Handler) registered to this route
Middleware() Middleware
// SetMiddleware changes/sets the middleware(handler(s)) for this route
SetMiddleware(Middleware)
@@ -817,9 +817,9 @@ func (r *route) hasCors() bool {
}
const (
- // subdomainIndicator where './' exists in a registed path then it contains subdomain
+ // subdomainIndicator where './' exists in a registered path then it contains subdomain
subdomainIndicator = "./"
- // dynamicSubdomainIndicator where a registed path starts with '*.' then it contains a dynamic subdomain, if subdomain == "*." then its dynamic
+ // dynamicSubdomainIndicator where a registered path starts with '*.' then it contains a dynamic subdomain, if subdomain == "*." then its dynamic
dynamicSubdomainIndicator = "*."
)
@@ -958,7 +958,7 @@ func (mux *serveMux) build() (methodEqual func(string, string) bool) {
tree = &muxTree{method: r.method, subdomain: r.subdomain, entry: &muxEntry{}}
mux.garden = append(mux.garden, tree)
}
- // I decide that it's better to explicit give subdomain and a path to it than registedPath(mysubdomain./something) now its: subdomain: mysubdomain., path: /something
+ // I decide that it's better to explicit give subdomain and a path to it than registeredPath(mysubdomain./something) now its: subdomain: mysubdomain., path: /something
// we have different tree for each of subdomains, now you can use everything you can use with the normal paths ( before you couldn't set /any/*path)
if err := tree.entry.add(r.path, r.middleware); err != nil {
mux.logger.Panic(err)
View
@@ -293,7 +293,7 @@ type testRoute struct {
func TestMuxSimple(t *testing.T) {
testRoutes := []testRoute{
- // FOUND - registed
+ // FOUND - registered
{"GET", "/test_get", "/test_get", "", "hello, get!", 200, true, nil, nil},
{"POST", "/test_post", "/test_post", "", "hello, post!", 200, true, nil, nil},
{"PUT", "/test_put", "/test_put", "", "hello, put!", 200, true, nil, nil},
@@ -303,7 +303,7 @@ func TestMuxSimple(t *testing.T) {
{"CONNECT", "/test_connect", "/test_connect", "", "hello, connect!", 200, true, nil, nil},
{"PATCH", "/test_patch", "/test_patch", "", "hello, patch!", 200, true, nil, nil},
{"TRACE", "/test_trace", "/test_trace", "", "hello, trace!", 200, true, nil, nil},
- // NOT FOUND - not registed
+ // NOT FOUND - not registered
{"GET", "/test_get_nofound", "/test_get_nofound", "", "Not Found", 404, false, nil, nil},
{"POST", "/test_post_nofound", "/test_post_nofound", "", "Not Found", 404, false, nil, nil},
{"PUT", "/test_put_nofound", "/test_put_nofound", "", "Not Found", 404, false, nil, nil},
@@ -519,7 +519,7 @@ func TestMuxCustomErrors(t *testing.T) {
notFoundMessage = "Iris custom message for 404 not found"
internalServerMessage = "Iris custom message for 500 internal server error"
testRoutesCustomErrors = []testRoute{
- // NOT FOUND CUSTOM ERRORS - not registed
+ // NOT FOUND CUSTOM ERRORS - not registered
{"GET", "/test_get_nofound_custom", "/test_get_nofound_custom", "", notFoundMessage, 404, false, nil, nil},
{"POST", "/test_post_nofound_custom", "/test_post_nofound_custom", "", notFoundMessage, 404, false, nil, nil},
{"PUT", "/test_put_nofound_custom", "/test_put_nofound_custom", "", notFoundMessage, 404, false, nil, nil},
@@ -529,7 +529,7 @@ func TestMuxCustomErrors(t *testing.T) {
{"CONNECT", "/test_connect_nofound_custom", "/test_connect_nofound_custom", "", notFoundMessage, 404, false, nil, nil},
{"PATCH", "/test_patch_nofound_custom", "/test_patch_nofound_custom", "", notFoundMessage, 404, false, nil, nil},
{"TRACE", "/test_trace_nofound_custom", "/test_trace_nofound_custom", "", notFoundMessage, 404, false, nil, nil},
- // SERVER INTERNAL ERROR 500 PANIC CUSTOM ERRORS - registed
+ // SERVER INTERNAL ERROR 500 PANIC CUSTOM ERRORS - registered
{"GET", "/test_get_panic_custom", "/test_get_panic_custom", "", internalServerMessage, 500, true, nil, nil},
{"POST", "/test_post_panic_custom", "/test_post_panic_custom", "", internalServerMessage, 500, true, nil, nil},
{"PUT", "/test_put_panic_custom", "/test_put_panic_custom", "", internalServerMessage, 500, true, nil, nil},
@@ -618,7 +618,7 @@ func TestMuxAPI(t *testing.T) {
}}
iris.API("/users", testUserAPI{}, h...)
- // test a simple .Party with compination of .API
+ // test a simple .Party with combination of .API
iris.Party("sites/:site").API("/users", testUserAPI{}, h...)
e := httptest.New(iris.Default, t)
@@ -716,70 +716,6 @@ func TestMuxFireMethodNotAllowed(t *testing.T) {
iris.Close()
}
-/*
-var (
- cacheDuration = 2 * time.Second
- errCacheTestFailed = errors.New("Expected the main handler to be executed %d times instead of %d.")
-)
-
-// ~14secs
-func runCacheTest(e *httpexpect.Expect, path string, counterPtr *uint32, expectedBodyStr, expectedContentType string) error {
- e.GET(path).Expect().Status(iris.StatusOK).Body().Equal(expectedBodyStr)
- time.Sleep(cacheDuration / 5) // lets wait for a while, cache should be saved and ready
- e.GET(path).Expect().Status(iris.StatusOK).Body().Equal(expectedBodyStr)
- counter := atomic.LoadUint32(counterPtr)
- if counter > 1 {
- // n should be 1 because it doesn't changed after the first call
- return errCacheTestFailed.Format(1, counter)
- }
- time.Sleep(cacheDuration)
-
- // cache should be cleared now
- e.GET(path).Expect().Status(iris.StatusOK).ContentType(expectedContentType, "utf-8").Body().Equal(expectedBodyStr)
- time.Sleep(cacheDuration / 5)
- // let's call again , the cache should be saved
- e.GET(path).Expect().Status(iris.StatusOK).ContentType(expectedContentType, "utf-8").Body().Equal(expectedBodyStr)
- counter = atomic.LoadUint32(counterPtr)
- if counter != 2 {
- return errCacheTestFailed.Format(2, counter)
- }
-
- return nil
-}
-
-
-Inside github.com/geekypanda/httpcache are enough, no need to add 10+ seconds of testing here.
-func TestCache(t *testing.T) {
-
- iris.ResetDefault()
-
- expectedBodyStr := "Imagine it as a big message to achieve x20 response performance!"
- var textCounter, htmlCounter uint32
-
- iris.Get("/text", iris.Cache(func(ctx *iris.Context) {
- atomic.AddUint32(&textCounter, 1)
- ctx.Text(iris.StatusOK, expectedBodyStr)
- }, cacheDuration))
-
- iris.Get("/html", iris.Cache(func(ctx *iris.Context) {
- atomic.AddUint32(&htmlCounter, 1)
- ctx.HTML(iris.StatusOK, expectedBodyStr)
- }, cacheDuration))
-
- e := httptest.New(iris.Default, t)
-
- // test cache on text/plain
- if err := runCacheTest(e, "/text", &textCounter, expectedBodyStr, "text/plain"); err != nil {
- t.Fatal(err)
- }
-
- // text cache on text/html
- if err := runCacheTest(e, "/html", &htmlCounter, expectedBodyStr, "text/html"); err != nil {
- t.Fatal(err)
- }
-}
-*/
-
func TestRedirectHTTPS(t *testing.T) {
api := iris.New(iris.OptionIsDevelopment(true))
@@ -794,5 +730,4 @@ func TestRedirectHTTPS(t *testing.T) {
e := httptest.New(api, t)
e.GET("/redirect").Expect().Status(iris.StatusOK).Body().Equal(expectedBody)
-
}
Oops, something went wrong.

0 comments on commit 1d055f6

Please sign in to comment.