Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 Add emoji's to commits #552

Merged
merged 10 commits into from
Jul 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*.fiber.gz
*.fasthttp.gz
*.pprof
*.workspace

# Dependencies
vendor
26 changes: 17 additions & 9 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,47 +294,55 @@ func (app *App) Use(args ...interface{}) *Route {
return app.register("USE", prefix, handlers...)
}

// Get ...
// Get registers a route for GET methods that requests a representation
// of the specified resource. Requests using GET should only retrieve data.
func (app *App) Get(path string, handlers ...Handler) *Route {
return app.Add(MethodGet, path, handlers...)
}

// Head ...
// Head registers a route for HEAD methods that asks for a response identical
// to that of a GET request, but without the response body.
func (app *App) Head(path string, handlers ...Handler) *Route {
return app.Add(MethodHead, path, handlers...)
}

// Post ...
// Post registers a route for POST methods that is used to submit an entity to the
// specified resource, often causing a change in state or side effects on the server.
func (app *App) Post(path string, handlers ...Handler) *Route {
return app.Add(MethodPost, path, handlers...)
}

// Put ...
// Put registers a route for PUT methods that replaces all current representations
// of the target resource with the request payload.
func (app *App) Put(path string, handlers ...Handler) *Route {
return app.Add(MethodPut, path, handlers...)
}

// Delete ...
// Delete registers a route for DELETE methods that deletes the specified resource.
func (app *App) Delete(path string, handlers ...Handler) *Route {
return app.Add(MethodDelete, path, handlers...)
}

// Connect ...
// Connect registers a route for CONNECT methods that establishes a tunnel to the
// server identified by the target resource.
func (app *App) Connect(path string, handlers ...Handler) *Route {
return app.Add(MethodConnect, path, handlers...)
}

// Options ...
// Options registers a route for OPTIONS methods that is used to describe the
// communication options for the target resource.
func (app *App) Options(path string, handlers ...Handler) *Route {
return app.Add(MethodOptions, path, handlers...)
}

// Trace ...
// Trace registers a route for TRACE methods that performs a message loop-back
// test along the path to the target resource.
func (app *App) Trace(path string, handlers ...Handler) *Route {
return app.Add(MethodTrace, path, handlers...)
}

// Patch ...
// Patch registers a route for PATCH methods that is used to apply partial
// modifications to a resource.
func (app *App) Patch(path string, handlers ...Handler) *Route {
return app.Add(MethodPatch, path, handlers...)
}
Expand Down
6 changes: 5 additions & 1 deletion app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,11 @@ func Test_App_Shutdown(t *testing.T) {
app := New(&Settings{
DisableStartupMessage: true,
})
_ = app.Shutdown()
if err := app.Shutdown(); err != nil {
if err.Error() != "shutdown: server is not running" {
t.Fatal()
}
}
}

// go test -run Test_App_Static_Index_Default
Expand Down
26 changes: 17 additions & 9 deletions group.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,47 +38,55 @@ func (grp *Group) Use(args ...interface{}) *Route {
return grp.app.register("USE", getGroupPath(grp.prefix, path), handlers...)
}

// Get ...
// Get registers a route for GET methods that requests a representation
// of the specified resource. Requests using GET should only retrieve data.
func (grp *Group) Get(path string, handlers ...Handler) *Route {
return grp.Add(MethodGet, path, handlers...)
}

// Head ...
// Head registers a route for HEAD methods that asks for a response identical
// to that of a GET request, but without the response body.
func (grp *Group) Head(path string, handlers ...Handler) *Route {
return grp.Add(MethodHead, path, handlers...)
}

// Post ...
// Post registers a route for POST methods that is used to submit an entity to the
// specified resource, often causing a change in state or side effects on the server.
func (grp *Group) Post(path string, handlers ...Handler) *Route {
return grp.Add(MethodPost, path, handlers...)
}

// Put ...
// Put registers a route for PUT methods that replaces all current representations
// of the target resource with the request payload.
func (grp *Group) Put(path string, handlers ...Handler) *Route {
return grp.Add(MethodPut, path, handlers...)
}

// Delete ...
// Delete registers a route for DELETE methods that deletes the specified resource.
func (grp *Group) Delete(path string, handlers ...Handler) *Route {
return grp.Add(MethodDelete, path, handlers...)
}

// Connect ...
// Connect registers a route for CONNECT methods that establishes a tunnel to the
// server identified by the target resource.
func (grp *Group) Connect(path string, handlers ...Handler) *Route {
return grp.Add(MethodConnect, path, handlers...)
}

// Options ...
// Options registers a route for OPTIONS methods that is used to describe the
// communication options for the target resource.
func (grp *Group) Options(path string, handlers ...Handler) *Route {
return grp.Add(MethodOptions, path, handlers...)
}

// Trace ...
// Trace registers a route for TRACE methods that performs a message loop-back
// test along the path to the target resource.
func (grp *Group) Trace(path string, handlers ...Handler) *Route {
return grp.Add(MethodTrace, path, handlers...)
}

// Patch ...
// Patch registers a route for PATCH methods that is used to apply partial
// modifications to a resource.
func (grp *Group) Patch(path string, handlers ...Handler) *Route {
return grp.Add(MethodPatch, path, handlers...)
}
Expand Down
2 changes: 1 addition & 1 deletion middleware/compress.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ type CompressConfig struct {
Level int
}

// Compression levels
// Compression levels determine the compression complexity
const (
CompressLevelDisabled = -1
CompressLevelDefault = 0
Expand Down
1 change: 1 addition & 0 deletions path.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type paramSeg struct {

// list of possible parameter and segment delimiter
// slash has a special role, unlike the other parameters it must not be interpreted as a parameter
// TODO '(' ')' delimiters for regex patterns
var routeDelimiter = []byte{'/', '-', '.'}

const wildcardParam string = "*"
Expand Down
1 change: 1 addition & 0 deletions path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ func Test_Path_matchParams(t *testing.T) {
{url: "/api/joker/batman/robin/1", params: []string{"joker/batman", "robin", "1"}, match: true},
{url: "/api/joker/batman/robin/1/2", params: []string{"joker/batman/robin", "1", "2"}, match: true},
{url: "/api", params: nil, match: false},
{url: "/api/:test", params: nil, match: false},
})
testCase("/", []testparams{
{url: "/api", params: nil, match: false},
Expand Down
1 change: 1 addition & 0 deletions reuseport.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// +build !windows

package fiber

import (
Expand Down