🧩 Describe HTTP methods

pull/552/head
Fenny 2020-07-06 17:56:03 +02:00
parent 33d5a9cb7b
commit 7ea6b2a9d0
1 changed files with 17 additions and 9 deletions

View File

@ -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...)
}