https://github.com/i2bskn/overridemethod
HTTP method overriding
https://github.com/i2bskn/overridemethod
go http
Last synced: 5 months ago
JSON representation
HTTP method overriding
- Host: GitHub
- URL: https://github.com/i2bskn/overridemethod
- Owner: i2bskn
- License: mit
- Created: 2017-03-25T02:03:14.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-26T00:52:55.000Z (about 9 years ago)
- Last Synced: 2024-06-20T13:28:44.809Z (almost 2 years ago)
- Topics: go, http
- Language: Go
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# overridemethod
[](https://godoc.org/github.com/i2bskn/overridemethod)
[](https://travis-ci.org/i2bskn/overridemethod)
[](https://codecov.io/gh/i2bskn/overridemethod)
## Dependencies
- [Go](https://golang.org/) 1.7 or lator
No dependency on the third party library.
## Installation
```
go get -u github.com/i2bskn/overridemethod
```
## Usage
Example for `net/http`:
```Go
package main
import (
"fmt"
"log"
"net/http"
"github.com/i2bskn/overridemethod"
)
func main() {
mux := http.NewServeMux()
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Override %s with %s", overridemethod.Origin(r), r.Method)
})
mw := overridemethod.Middleware()
log.Fatal(http.ListenAndServe(":8080", mw(mux)))
}
```
See also [GoDoc](https://godoc.org/github.com/i2bskn/overridemethod).
## License
overridemethod is available under the MIT.