build(deps): bump github.com/go-chi/chi/v5 from 5.0.12 to 5.1.0

Bumps [github.com/go-chi/chi/v5](https://github.com/go-chi/chi) from 5.0.12 to 5.1.0.
- [Release notes](https://github.com/go-chi/chi/releases)
- [Changelog](https://github.com/go-chi/chi/blob/master/CHANGELOG.md)
- [Commits](https://github.com/go-chi/chi/compare/v5.0.12...v5.1.0)

---
updated-dependencies:
- dependency-name: github.com/go-chi/chi/v5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot]
2024-07-01 06:33:56 +00:00
committed by GitHub
parent 654af5ca7c
commit 775be35200
7 changed files with 39 additions and 21 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ require (
github.com/egirna/icap-client v0.1.1 github.com/egirna/icap-client v0.1.1
github.com/gabriel-vasile/mimetype v1.4.4 github.com/gabriel-vasile/mimetype v1.4.4
github.com/ggwhite/go-masker v1.1.0 github.com/ggwhite/go-masker v1.1.0
github.com/go-chi/chi/v5 v5.0.12 github.com/go-chi/chi/v5 v5.1.0
github.com/go-chi/cors v1.2.1 github.com/go-chi/cors v1.2.1
github.com/go-chi/render v1.0.3 github.com/go-chi/render v1.0.3
github.com/go-jose/go-jose/v3 v3.0.3 github.com/go-jose/go-jose/v3 v3.0.3
+2 -2
View File
@@ -1140,8 +1140,8 @@ github.com/go-asn1-ber/asn1-ber v1.4.1/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkPro
github.com/go-asn1-ber/asn1-ber v1.5.5 h1:MNHlNMBDgEKD4TcKr36vQN68BA00aDfjIt3/bD50WnA= github.com/go-asn1-ber/asn1-ber v1.5.5 h1:MNHlNMBDgEKD4TcKr36vQN68BA00aDfjIt3/bD50WnA=
github.com/go-asn1-ber/asn1-ber v1.5.5/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0= github.com/go-asn1-ber/asn1-ber v1.5.5/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkProFKoKdwZRWMe0=
github.com/go-chi/chi v4.0.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ= github.com/go-chi/chi v4.0.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
github.com/go-chi/chi/v5 v5.0.12 h1:9euLV5sTrTNTRUU9POmDUvfxyj6LAABLUcEWO+JJb4s= github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw=
github.com/go-chi/chi/v5 v5.0.12/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4= github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4=
github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58= github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58=
github.com/go-chi/render v1.0.3 h1:AsXqd2a1/INaIfUSKq3G5uA8weYx20FOsM7uSoCyyt4= github.com/go-chi/render v1.0.3 h1:AsXqd2a1/INaIfUSKq3G5uA8weYx20FOsM7uSoCyyt4=
+6 -6
View File
@@ -14,7 +14,7 @@
A typical workflow is: A typical workflow is:
1. [Fork the repository.][fork] [This tip maybe also helpful.][go-fork-tip] 1. [Fork the repository.][fork]
2. [Create a topic branch.][branch] 2. [Create a topic branch.][branch]
3. Add tests for your change. 3. Add tests for your change.
4. Run `go test`. If your tests pass, return to the step 3. 4. Run `go test`. If your tests pass, return to the step 3.
@@ -24,8 +24,8 @@ A typical workflow is:
8. [Submit a pull request.][pull-req] 8. [Submit a pull request.][pull-req]
[go-install]: https://golang.org/doc/install [go-install]: https://golang.org/doc/install
[go-fork-tip]: http://blog.campoy.cat/2014/03/github-and-go-forking-pull-requests-and.html [fork]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo
[fork]: https://help.github.com/articles/fork-a-repo [branch]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-branches
[branch]: http://learn.github.com/p/branching.html [git-help]: https://docs.github.com/en
[git-help]: https://guides.github.com [pull-req]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests
[pull-req]: https://help.github.com/articles/using-pull-requests
+1 -2
View File
@@ -74,9 +74,8 @@ type Context struct {
// patterns across a stack of sub-routers. // patterns across a stack of sub-routers.
RoutePatterns []string RoutePatterns []string
// methodNotAllowed hint
methodNotAllowed bool
methodsAllowed []methodTyp // allowed methods in case of a 405 methodsAllowed []methodTyp // allowed methods in case of a 405
methodNotAllowed bool
} }
// Reset a routing context to its initial state. // Reset a routing context to its initial state.
+1 -1
View File
@@ -22,7 +22,7 @@ var xRealIP = http.CanonicalHeaderKey("X-Real-IP")
// RemoteAddr will see the intended value. // RemoteAddr will see the intended value.
// //
// You should only use this middleware if you can trust the headers passed to // You should only use this middleware if you can trust the headers passed to
// you (in particular, the two headers this middleware uses), for example // you (in particular, the three headers this middleware uses), for example
// because you have placed a reverse proxy like HAProxy or nginx in front of // because you have placed a reverse proxy like HAProxy or nginx in front of
// chi. If your reverse proxies are configured to pass along arbitrary header // chi. If your reverse proxies are configured to pass along arbitrary header
// values from the client, or if you use this middleware without a reverse // values from the client, or if you use this middleware without a reverse
+27 -8
View File
@@ -6,6 +6,7 @@ package middleware
import ( import (
"bufio" "bufio"
"io" "io"
"io/ioutil"
"net" "net"
"net/http" "net/http"
) )
@@ -61,6 +62,11 @@ type WrapResponseWriter interface {
Tee(io.Writer) Tee(io.Writer)
// Unwrap returns the original proxied target. // Unwrap returns the original proxied target.
Unwrap() http.ResponseWriter Unwrap() http.ResponseWriter
// Discard causes all writes to the original ResponseWriter be discarded,
// instead writing only to the tee'd writer if it's set.
// The caller is responsible for calling WriteHeader and Write on the
// original ResponseWriter once the processing is done.
Discard()
} }
// basicWriter wraps a http.ResponseWriter that implements the minimal // basicWriter wraps a http.ResponseWriter that implements the minimal
@@ -71,25 +77,34 @@ type basicWriter struct {
code int code int
bytes int bytes int
tee io.Writer tee io.Writer
discard bool
} }
func (b *basicWriter) WriteHeader(code int) { func (b *basicWriter) WriteHeader(code int) {
if !b.wroteHeader { if !b.wroteHeader {
b.code = code b.code = code
b.wroteHeader = true b.wroteHeader = true
b.ResponseWriter.WriteHeader(code) if !b.discard {
b.ResponseWriter.WriteHeader(code)
}
} }
} }
func (b *basicWriter) Write(buf []byte) (int, error) { func (b *basicWriter) Write(buf []byte) (n int, err error) {
b.maybeWriteHeader() b.maybeWriteHeader()
n, err := b.ResponseWriter.Write(buf) if !b.discard {
if b.tee != nil { n, err = b.ResponseWriter.Write(buf)
_, err2 := b.tee.Write(buf[:n]) if b.tee != nil {
// Prefer errors generated by the proxied writer. _, err2 := b.tee.Write(buf[:n])
if err == nil { // Prefer errors generated by the proxied writer.
err = err2 if err == nil {
err = err2
}
} }
} else if b.tee != nil {
n, err = b.tee.Write(buf)
} else {
n, err = ioutil.Discard.Write(buf)
} }
b.bytes += n b.bytes += n
return n, err return n, err
@@ -117,6 +132,10 @@ func (b *basicWriter) Unwrap() http.ResponseWriter {
return b.ResponseWriter return b.ResponseWriter
} }
func (b *basicWriter) Discard() {
b.discard = true
}
// flushWriter ... // flushWriter ...
type flushWriter struct { type flushWriter struct {
basicWriter basicWriter
+1 -1
View File
@@ -821,7 +821,7 @@ github.com/go-acme/lego/v4/challenge
# github.com/go-asn1-ber/asn1-ber v1.5.5 # github.com/go-asn1-ber/asn1-ber v1.5.5
## explicit; go 1.13 ## explicit; go 1.13
github.com/go-asn1-ber/asn1-ber github.com/go-asn1-ber/asn1-ber
# github.com/go-chi/chi/v5 v5.0.12 # github.com/go-chi/chi/v5 v5.1.0
## explicit; go 1.14 ## explicit; go 1.14
github.com/go-chi/chi/v5 github.com/go-chi/chi/v5
github.com/go-chi/chi/v5/middleware github.com/go-chi/chi/v5/middleware