Use new gorilla way of using middleware

This commit is contained in:
Lena Fuhrimann 2018-01-22 01:55:38 +01:00
parent fd67b24857
commit 0371ad0b02
3 changed files with 65 additions and 26 deletions

67
Gopkg.lock generated
View file

@ -16,8 +16,8 @@
[[projects]] [[projects]]
name = "github.com/go-ini/ini" name = "github.com/go-ini/ini"
packages = ["."] packages = ["."]
revision = "32e4c1e6bc4e7d0d8451aa6b75200d19e37a536a" revision = "6333e38ac20b8949a8dd68baa3650f4dee8f39f0"
version = "v1.32.0" version = "v1.33.0"
[[projects]] [[projects]]
name = "github.com/gorilla/context" name = "github.com/gorilla/context"
@ -28,20 +28,28 @@
[[projects]] [[projects]]
name = "github.com/gorilla/mux" name = "github.com/gorilla/mux"
packages = ["."] packages = ["."]
revision = "7f08801859139f86dfafd1c296e2cba9a80d292e" revision = "53c1911da2b537f792e7cafcb446b05ffe33b996"
version = "v1.6.0" version = "v1.6.1"
[[projects]] [[projects]]
branch = "master" branch = "master"
name = "github.com/mastertinner/adapters" name = "github.com/mastertinner/adapters"
packages = ["logging"] packages = ["logging"]
revision = "13192f10bc2b687f23f1aef2d06a7a7c35dd81e9" revision = "368acae73d1569f0495b00991aaa85ec27d6ee8e"
[[projects]] [[projects]]
name = "github.com/minio/minio-go" name = "github.com/minio/minio-go"
packages = [".","pkg/credentials","pkg/encrypt","pkg/policy","pkg/s3signer","pkg/s3utils","pkg/set"] packages = [
revision = "14f1d472d115bac5ca4804094aa87484a72ced61" ".",
version = "4.0.6" "pkg/credentials",
"pkg/encrypt",
"pkg/policy",
"pkg/s3signer",
"pkg/s3utils",
"pkg/set"
]
revision = "9e124ec59547551cb3f1324f73623bbb30650cf8"
version = "4.0.9"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -70,36 +78,57 @@
[[projects]] [[projects]]
name = "github.com/stretchr/testify" name = "github.com/stretchr/testify"
packages = ["assert"] packages = ["assert"]
revision = "b91bfb9ebec76498946beb6af7c0230c7cc7ba6c" revision = "12b6f73e6084dad08a7c6e575284b177ecafbc71"
version = "v1.2.0" version = "v1.2.1"
[[projects]] [[projects]]
branch = "master" branch = "master"
name = "golang.org/x/crypto" name = "golang.org/x/crypto"
packages = ["ssh/terminal"] packages = ["ssh/terminal"]
revision = "13931e22f9e72ea58bb73048bc752b48c6d4d4ac" revision = "c7dcf104e3a7a1417abc0230cb0d5240d764159d"
[[projects]] [[projects]]
branch = "master" branch = "master"
name = "golang.org/x/net" name = "golang.org/x/net"
packages = ["idna","lex/httplex"] packages = [
revision = "5ccada7d0a7ba9aeb5d3aca8d3501b4c2a509fec" "idna",
"lex/httplex"
]
revision = "d0aafc73d5cdc42264b0af071c261abac580695e"
[[projects]] [[projects]]
branch = "master" branch = "master"
name = "golang.org/x/sys" name = "golang.org/x/sys"
packages = ["unix","windows"] packages = [
revision = "810d7000345868fc619eb81f46307107118f4ae1" "unix",
"windows"
]
revision = "7dca6fe1f43775aa6d1334576870ff63f978f539"
[[projects]] [[projects]]
branch = "master"
name = "golang.org/x/text" name = "golang.org/x/text"
packages = ["collate","collate/build","internal/colltab","internal/gen","internal/tag","internal/triegen","internal/ucd","language","secure/bidirule","transform","unicode/bidi","unicode/cldr","unicode/norm","unicode/rangetable"] packages = [
revision = "e19ae1496984b1c655b8044a65c0300a3c878dd3" "collate",
"collate/build",
"internal/colltab",
"internal/gen",
"internal/tag",
"internal/triegen",
"internal/ucd",
"language",
"secure/bidirule",
"transform",
"unicode/bidi",
"unicode/cldr",
"unicode/norm",
"unicode/rangetable"
]
revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0"
version = "v0.3.0"
[solve-meta] [solve-meta]
analyzer-name = "dep" analyzer-name = "dep"
analyzer-version = 1 analyzer-version = 1
inputs-digest = "58dc726a32f10ee180cde55065bde7c2bfad6cbb1d6c40e85085bbcce50da1ae" inputs-digest = "c70e9710ac0caf3a2f9041ebee7ea3804e6474256bb86e91795a5eb8788accc6"
solver-name = "gps-cdcl" solver-name = "gps-cdcl"
solver-version = 1 solver-version = 1

View file

@ -1,4 +1,3 @@
# Gopkg.toml example # Gopkg.toml example
# #
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md # Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
@ -19,11 +18,16 @@
# [[override]] # [[override]]
# name = "github.com/x/y" # name = "github.com/x/y"
# version = "2.4.0" # version = "2.4.0"
#
# [prune]
# non-go = false
# go-tests = true
# unused-packages = true
[[constraint]] [[constraint]]
name = "github.com/gorilla/mux" name = "github.com/gorilla/mux"
version = "1.6.0" version = "1.6.1"
[[constraint]] [[constraint]]
branch = "master" branch = "master"
@ -31,7 +35,7 @@
[[constraint]] [[constraint]]
name = "github.com/minio/minio-go" name = "github.com/minio/minio-go"
version = "4.0.6" version = "4.0.9"
[[constraint]] [[constraint]]
name = "github.com/pkg/errors" name = "github.com/pkg/errors"
@ -39,4 +43,8 @@
[[constraint]] [[constraint]]
name = "github.com/stretchr/testify" name = "github.com/stretchr/testify"
version = "1.2.0" version = "1.2.1"
[prune]
go-tests = true
unused-packages = true

View file

@ -42,6 +42,8 @@ func main() {
// Set up router // Set up router
r := mux.NewRouter().StrictSlash(true) r := mux.NewRouter().StrictSlash(true)
r.Use(logging.Handler(os.Stdout))
r. r.
Methods(http.MethodGet). Methods(http.MethodGet).
Path("/"). Path("/").
@ -81,5 +83,5 @@ func main() {
Path("/api/buckets/{bucketName}/objects/{objectName}"). Path("/api/buckets/{bucketName}/objects/{objectName}").
Handler(s3manager.DeleteObjectHandler(s3)) Handler(s3manager.DeleteObjectHandler(s3))
log.Fatal(http.ListenAndServe(":"+*port, logging.Handler(os.Stdout)(r))) log.Fatal(http.ListenAndServe(":"+*port, r))
} }