mirror of
				https://github.com/42wim/matterbridge.git
				synced 2025-10-31 22:07:26 +01:00 
			
		
		
		
	Bump github.com/labstack/echo/v4 from 4.6.1 to 4.6.3 (#1685)
Bumps [github.com/labstack/echo/v4](https://github.com/labstack/echo) from 4.6.1 to 4.6.3. - [Release notes](https://github.com/labstack/echo/releases) - [Changelog](https://github.com/labstack/echo/blob/master/CHANGELOG.md) - [Commits](https://github.com/labstack/echo/compare/v4.6.1...v4.6.3) --- updated-dependencies: - dependency-name: github.com/labstack/echo/v4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									6aa05b3981
								
							
						
					
					
						commit
						61d56f26f8
					
				
							
								
								
									
										4
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								go.mod
									
									
									
									
									
								
							| @ -20,7 +20,7 @@ require ( | ||||
| 	github.com/jpillora/backoff v1.0.0 | ||||
| 	github.com/keybase/go-keybase-chat-bot v0.0.0-20211201215354-ee4b23828b55 | ||||
| 	github.com/kyokomi/emoji/v2 v2.2.8 | ||||
| 	github.com/labstack/echo/v4 v4.6.1 | ||||
| 	github.com/labstack/echo/v4 v4.6.3 | ||||
| 	github.com/lrstanley/girc v0.0.0-20211023233735-147f0ff77566 | ||||
| 	github.com/matrix-org/gomatrix v0.0.0-20210324163249-be2af5ef2e16 | ||||
| 	github.com/matterbridge/Rocket.Chat.Go.SDK v0.0.0-20211016222428-79310a412696 | ||||
| @ -75,7 +75,7 @@ require ( | ||||
| 	github.com/kettek/apng v0.0.0-20191108220231-414630eed80f // indirect | ||||
| 	github.com/klauspost/compress v1.13.6 // indirect | ||||
| 	github.com/klauspost/cpuid/v2 v2.0.9 // indirect | ||||
| 	github.com/labstack/gommon v0.3.0 // indirect | ||||
| 	github.com/labstack/gommon v0.3.1 // indirect | ||||
| 	github.com/magiconair/properties v1.8.5 // indirect | ||||
| 	github.com/mattermost/go-i18n v1.11.1-0.20211013152124-5c415071e404 // indirect | ||||
| 	github.com/mattermost/ldap v0.0.0-20201202150706-ee0e6284187d // indirect | ||||
|  | ||||
							
								
								
									
										10
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								go.sum
									
									
									
									
									
								
							| @ -1040,10 +1040,11 @@ github.com/ktrysmt/go-bitbucket v0.6.4/go.mod h1:9u0v3hsd2rqCHRIpbir1oP7F58uo5dq | ||||
| github.com/kyokomi/emoji/v2 v2.2.8 h1:jcofPxjHWEkJtkIbcLHvZhxKgCPl6C7MyjTrD4KDqUE= | ||||
| github.com/kyokomi/emoji/v2 v2.2.8/go.mod h1:JUcn42DTdsXJo1SWanHh4HKDEyPaR5CqkmoirZZP9qE= | ||||
| github.com/labstack/echo/v4 v4.1.11/go.mod h1:i541M3Fj6f76NZtHSj7TXnyM8n2gaodfvfxNnFqi74g= | ||||
| github.com/labstack/echo/v4 v4.6.1 h1:OMVsrnNFzYlGSdaiYGHbgWQnr+JM7NG+B9suCPie14M= | ||||
| github.com/labstack/echo/v4 v4.6.1/go.mod h1:RnjgMWNDB9g/HucVWhQYNQP9PvbYf6adqftqryo7s9k= | ||||
| github.com/labstack/gommon v0.3.0 h1:JEeO0bvc78PKdyHxloTKiF8BD5iGrH8T6MSeGvSgob0= | ||||
| github.com/labstack/echo/v4 v4.6.3 h1:VhPuIZYxsbPmo4m9KAkMU/el2442eB7EBFFhNTTT9ac= | ||||
| github.com/labstack/echo/v4 v4.6.3/go.mod h1:Hk5OiHj0kDqmFq7aHe7eDqI7CUhuCrfpupQtLGGLm7A= | ||||
| github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= | ||||
| github.com/labstack/gommon v0.3.1 h1:OomWaJXm7xR6L1HmEtGyQf26TEn7V6X88mktX9kee9o= | ||||
| github.com/labstack/gommon v0.3.1/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= | ||||
| github.com/lann/builder v0.0.0-20180802200727-47ae307949d0/go.mod h1:dXGbAdH5GtBTC4WfIxhKZfyBF/HBFgRZSWwZ9g/He9o= | ||||
| github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0/go.mod h1:vmVJ0l/dxyfGW6FmdpVm2joNMFikkuWg0EoCKLGUMNw= | ||||
| github.com/ledongthuc/pdf v0.0.0-20210621053716-e28cb8259002/go.mod h1:imJHygn/1yfhB7XSJJKlFZKl/J+dCPAknuiaGOshXAs= | ||||
| @ -1116,6 +1117,7 @@ github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc | ||||
| github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= | ||||
| github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= | ||||
| github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= | ||||
| github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= | ||||
| github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= | ||||
| github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= | ||||
| github.com/mattn/go-ieproxy v0.0.1/go.mod h1:pYabZ6IHcRpFh7vIaLfK7rdcWgFEb3SFJ6/gNWuh88E= | ||||
| @ -2093,10 +2095,10 @@ golang.org/x/sys v0.0.0-20210818153620-00dd8d7831e7/go.mod h1:oPkhp1MJrh7nUepCBc | ||||
| golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||
| golang.org/x/sys v0.0.0-20210902050250-f475640dd07b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||
| golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||
| golang.org/x/sys v0.0.0-20210910150752-751e447fb3d0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||
| golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||
| golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||
| golang.org/x/sys v0.0.0-20211013075003-97ac67df715c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||
| golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||
| golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||
| golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= | ||||
| golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= | ||||
|  | ||||
							
								
								
									
										23
									
								
								vendor/github.com/labstack/echo/v4/CHANGELOG.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										23
									
								
								vendor/github.com/labstack/echo/v4/CHANGELOG.md
									
									
									
										generated
									
									
										vendored
									
									
								
							| @ -1,5 +1,28 @@ | ||||
| # Changelog | ||||
| 
 | ||||
| ## v4.6.3 - 2022-01-10 | ||||
| 
 | ||||
| **Fixes** | ||||
| 
 | ||||
| * Fixed Echo version number in greeting message which was not incremented to `4.6.2` [#2066](https://github.com/labstack/echo/issues/2066) | ||||
| 
 | ||||
| 
 | ||||
| ## v4.6.2 - 2022-01-08 | ||||
| 
 | ||||
| **Fixes** | ||||
| 
 | ||||
| * Fixed route containing escaped colon should be matchable but is not matched to request path [#2047](https://github.com/labstack/echo/pull/2047) | ||||
| * Fixed a problem that returned wrong content-encoding when the gzip compressed content was empty. [#1921](https://github.com/labstack/echo/pull/1921) | ||||
| * Update (test) dependencies [#2021](https://github.com/labstack/echo/pull/2021) | ||||
| 
 | ||||
| 
 | ||||
| **Enhancements** | ||||
| 
 | ||||
| * Add support for configurable target header for the request_id middleware [#2040](https://github.com/labstack/echo/pull/2040) | ||||
| * Change decompress middleware to use stream decompression instead of buffering [#2018](https://github.com/labstack/echo/pull/2018) | ||||
| * Documentation updates | ||||
| 
 | ||||
| 
 | ||||
| ## v4.6.1 - 2021-09-26 | ||||
| 
 | ||||
| **Enhancements** | ||||
|  | ||||
							
								
								
									
										2
									
								
								vendor/github.com/labstack/echo/v4/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								vendor/github.com/labstack/echo/v4/README.md
									
									
									
										generated
									
									
										vendored
									
									
								
							| @ -66,9 +66,9 @@ go get github.com/labstack/echo/v4 | ||||
| package main | ||||
| 
 | ||||
| import ( | ||||
|   "net/http" | ||||
|   "github.com/labstack/echo/v4" | ||||
|   "github.com/labstack/echo/v4/middleware" | ||||
|   "net/http" | ||||
| ) | ||||
| 
 | ||||
| func main() { | ||||
|  | ||||
							
								
								
									
										3
									
								
								vendor/github.com/labstack/echo/v4/echo.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								vendor/github.com/labstack/echo/v4/echo.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @ -214,6 +214,7 @@ const ( | ||||
| 	HeaderXHTTPMethodOverride = "X-HTTP-Method-Override" | ||||
| 	HeaderXRealIP             = "X-Real-IP" | ||||
| 	HeaderXRequestID          = "X-Request-ID" | ||||
| 	HeaderXCorrelationID      = "X-Correlation-ID" | ||||
| 	HeaderXRequestedWith      = "X-Requested-With" | ||||
| 	HeaderServer              = "Server" | ||||
| 	HeaderOrigin              = "Origin" | ||||
| @ -241,7 +242,7 @@ const ( | ||||
| 
 | ||||
| const ( | ||||
| 	// Version of Echo | ||||
| 	Version = "4.6.1" | ||||
| 	Version = "4.6.3" | ||||
| 	website = "https://echo.labstack.com" | ||||
| 	// http://patorjk.com/software/taag/#p=display&f=Small%20Slant&t=Echo | ||||
| 	banner = ` | ||||
|  | ||||
							
								
								
									
										9
									
								
								vendor/github.com/labstack/echo/v4/middleware/compress.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								vendor/github.com/labstack/echo/v4/middleware/compress.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @ -27,6 +27,7 @@ type ( | ||||
| 	gzipResponseWriter struct { | ||||
| 		io.Writer | ||||
| 		http.ResponseWriter | ||||
| 		wroteBody bool | ||||
| 	} | ||||
| ) | ||||
| 
 | ||||
| @ -78,8 +79,9 @@ func GzipWithConfig(config GzipConfig) echo.MiddlewareFunc { | ||||
| 				} | ||||
| 				rw := res.Writer | ||||
| 				w.Reset(rw) | ||||
| 				grw := &gzipResponseWriter{Writer: w, ResponseWriter: rw} | ||||
| 				defer func() { | ||||
| 					if res.Size == 0 { | ||||
| 					if !grw.wroteBody { | ||||
| 						if res.Header().Get(echo.HeaderContentEncoding) == gzipScheme { | ||||
| 							res.Header().Del(echo.HeaderContentEncoding) | ||||
| 						} | ||||
| @ -92,7 +94,6 @@ func GzipWithConfig(config GzipConfig) echo.MiddlewareFunc { | ||||
| 					w.Close() | ||||
| 					pool.Put(w) | ||||
| 				}() | ||||
| 				grw := &gzipResponseWriter{Writer: w, ResponseWriter: rw} | ||||
| 				res.Writer = grw | ||||
| 			} | ||||
| 			return next(c) | ||||
| @ -101,9 +102,6 @@ func GzipWithConfig(config GzipConfig) echo.MiddlewareFunc { | ||||
| } | ||||
| 
 | ||||
| func (w *gzipResponseWriter) WriteHeader(code int) { | ||||
| 	if code == http.StatusNoContent { // Issue #489 | ||||
| 		w.ResponseWriter.Header().Del(echo.HeaderContentEncoding) | ||||
| 	} | ||||
| 	w.Header().Del(echo.HeaderContentLength) // Issue #444 | ||||
| 	w.ResponseWriter.WriteHeader(code) | ||||
| } | ||||
| @ -112,6 +110,7 @@ func (w *gzipResponseWriter) Write(b []byte) (int, error) { | ||||
| 	if w.Header().Get(echo.HeaderContentType) == "" { | ||||
| 		w.Header().Set(echo.HeaderContentType, http.DetectContentType(b)) | ||||
| 	} | ||||
| 	w.wroteBody = true | ||||
| 	return w.Writer.Write(b) | ||||
| } | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										75
									
								
								vendor/github.com/labstack/echo/v4/middleware/decompress.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										75
									
								
								vendor/github.com/labstack/echo/v4/middleware/decompress.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @ -1,10 +1,8 @@ | ||||
| package middleware | ||||
| 
 | ||||
| import ( | ||||
| 	"bytes" | ||||
| 	"compress/gzip" | ||||
| 	"io" | ||||
| 	"io/ioutil" | ||||
| 	"net/http" | ||||
| 	"sync" | ||||
| 
 | ||||
| @ -43,26 +41,7 @@ type DefaultGzipDecompressPool struct { | ||||
| } | ||||
| 
 | ||||
| func (d *DefaultGzipDecompressPool) gzipDecompressPool() sync.Pool { | ||||
| 	return sync.Pool{ | ||||
| 		New: func() interface{} { | ||||
| 			// create with an empty reader (but with GZIP header) | ||||
| 			w, err := gzip.NewWriterLevel(ioutil.Discard, gzip.BestSpeed) | ||||
| 			if err != nil { | ||||
| 				return err | ||||
| 			} | ||||
| 
 | ||||
| 			b := new(bytes.Buffer) | ||||
| 			w.Reset(b) | ||||
| 			w.Flush() | ||||
| 			w.Close() | ||||
| 
 | ||||
| 			r, err := gzip.NewReader(bytes.NewReader(b.Bytes())) | ||||
| 			if err != nil { | ||||
| 				return err | ||||
| 			} | ||||
| 			return r | ||||
| 		}, | ||||
| 	} | ||||
| 	return sync.Pool{New: func() interface{} { return new(gzip.Reader) }} | ||||
| } | ||||
| 
 | ||||
| //Decompress decompresses request body based if content encoding type is set to "gzip" with default config | ||||
| @ -82,38 +61,38 @@ func DecompressWithConfig(config DecompressConfig) echo.MiddlewareFunc { | ||||
| 
 | ||||
| 	return func(next echo.HandlerFunc) echo.HandlerFunc { | ||||
| 		pool := config.GzipDecompressPool.gzipDecompressPool() | ||||
| 
 | ||||
| 		return func(c echo.Context) error { | ||||
| 			if config.Skipper(c) { | ||||
| 				return next(c) | ||||
| 			} | ||||
| 			switch c.Request().Header.Get(echo.HeaderContentEncoding) { | ||||
| 			case GZIPEncoding: | ||||
| 				b := c.Request().Body | ||||
| 
 | ||||
| 				i := pool.Get() | ||||
| 				gr, ok := i.(*gzip.Reader) | ||||
| 				if !ok { | ||||
| 					return echo.NewHTTPError(http.StatusInternalServerError, i.(error).Error()) | ||||
| 				} | ||||
| 
 | ||||
| 				if err := gr.Reset(b); err != nil { | ||||
| 					pool.Put(gr) | ||||
| 					if err == io.EOF { //ignore if body is empty | ||||
| 						return next(c) | ||||
| 					} | ||||
| 					return err | ||||
| 				} | ||||
| 				var buf bytes.Buffer | ||||
| 				io.Copy(&buf, gr) | ||||
| 
 | ||||
| 				gr.Close() | ||||
| 				pool.Put(gr) | ||||
| 
 | ||||
| 				b.Close() // http.Request.Body is closed by the Server, but because we are replacing it, it must be closed here | ||||
| 
 | ||||
| 				r := ioutil.NopCloser(&buf) | ||||
| 				c.Request().Body = r | ||||
| 			if c.Request().Header.Get(echo.HeaderContentEncoding) != GZIPEncoding { | ||||
| 				return next(c) | ||||
| 			} | ||||
| 
 | ||||
| 			i := pool.Get() | ||||
| 			gr, ok := i.(*gzip.Reader) | ||||
| 			if !ok || gr == nil { | ||||
| 				return echo.NewHTTPError(http.StatusInternalServerError, i.(error).Error()) | ||||
| 			} | ||||
| 			defer pool.Put(gr) | ||||
| 
 | ||||
| 			b := c.Request().Body | ||||
| 			defer b.Close() | ||||
| 
 | ||||
| 			if err := gr.Reset(b); err != nil { | ||||
| 				if err == io.EOF { //ignore if body is empty | ||||
| 					return next(c) | ||||
| 				} | ||||
| 				return err | ||||
| 			} | ||||
| 
 | ||||
| 			// only Close gzip reader if it was set to a proper gzip source otherwise it will panic on close. | ||||
| 			defer gr.Close() | ||||
| 
 | ||||
| 			c.Request().Body = gr | ||||
| 
 | ||||
| 			return next(c) | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
							
								
								
									
										13
									
								
								vendor/github.com/labstack/echo/v4/middleware/rate_limiter.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								vendor/github.com/labstack/echo/v4/middleware/rate_limiter.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @ -153,9 +153,10 @@ func RateLimiterWithConfig(config RateLimiterConfig) echo.MiddlewareFunc { | ||||
| type ( | ||||
| 	// RateLimiterMemoryStore is the built-in store implementation for RateLimiter | ||||
| 	RateLimiterMemoryStore struct { | ||||
| 		visitors    map[string]*Visitor | ||||
| 		mutex       sync.Mutex | ||||
| 		rate        rate.Limit | ||||
| 		visitors map[string]*Visitor | ||||
| 		mutex    sync.Mutex | ||||
| 		rate     rate.Limit //for more info check out Limiter docs - https://pkg.go.dev/golang.org/x/time/rate#Limit. | ||||
| 
 | ||||
| 		burst       int | ||||
| 		expiresIn   time.Duration | ||||
| 		lastCleanup time.Time | ||||
| @ -170,6 +171,8 @@ type ( | ||||
| /* | ||||
| NewRateLimiterMemoryStore returns an instance of RateLimiterMemoryStore with | ||||
| the provided rate (as req/s). The provided rate less than 1 will be treated as zero. | ||||
| for more info check out Limiter docs - https://pkg.go.dev/golang.org/x/time/rate#Limit. | ||||
| 
 | ||||
| Burst and ExpiresIn will be set to default values. | ||||
| 
 | ||||
| Example (with 20 requests/sec): | ||||
| @ -199,7 +202,7 @@ Characteristics: | ||||
| Example: | ||||
| 
 | ||||
| 	limiterStore := middleware.NewRateLimiterMemoryStoreWithConfig( | ||||
| 		middleware.RateLimiterMemoryStoreConfig{Rate: 50, Burst: 200, ExpiresIn: 5 * time.Minutes}, | ||||
| 		middleware.RateLimiterMemoryStoreConfig{Rate: 50, Burst: 200, ExpiresIn: 5 * time.Minute}, | ||||
| 	) | ||||
| */ | ||||
| func NewRateLimiterMemoryStoreWithConfig(config RateLimiterMemoryStoreConfig) (store *RateLimiterMemoryStore) { | ||||
| @ -221,7 +224,7 @@ func NewRateLimiterMemoryStoreWithConfig(config RateLimiterMemoryStoreConfig) (s | ||||
| 
 | ||||
| // RateLimiterMemoryStoreConfig represents configuration for RateLimiterMemoryStore | ||||
| type RateLimiterMemoryStoreConfig struct { | ||||
| 	Rate      rate.Limit    // Rate of requests allowed to pass as req/s | ||||
| 	Rate      rate.Limit    // Rate of requests allowed to pass as req/s. For more info check out Limiter docs - https://pkg.go.dev/golang.org/x/time/rate#Limit. | ||||
| 	Burst     int           // Burst additionally allows a number of requests to pass when rate limit is reached | ||||
| 	ExpiresIn time.Duration // ExpiresIn is the duration after that a rate limiter is cleaned up | ||||
| } | ||||
|  | ||||
							
								
								
									
										15
									
								
								vendor/github.com/labstack/echo/v4/middleware/request_id.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										15
									
								
								vendor/github.com/labstack/echo/v4/middleware/request_id.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @ -17,14 +17,18 @@ type ( | ||||
| 
 | ||||
| 		// RequestIDHandler defines a function which is executed for a request id. | ||||
| 		RequestIDHandler func(echo.Context, string) | ||||
| 
 | ||||
| 		// TargetHeader defines what header to look for to populate the id | ||||
| 		TargetHeader string | ||||
| 	} | ||||
| ) | ||||
| 
 | ||||
| var ( | ||||
| 	// DefaultRequestIDConfig is the default RequestID middleware config. | ||||
| 	DefaultRequestIDConfig = RequestIDConfig{ | ||||
| 		Skipper:   DefaultSkipper, | ||||
| 		Generator: generator, | ||||
| 		Skipper:      DefaultSkipper, | ||||
| 		Generator:    generator, | ||||
| 		TargetHeader: echo.HeaderXRequestID, | ||||
| 	} | ||||
| ) | ||||
| 
 | ||||
| @ -42,6 +46,9 @@ func RequestIDWithConfig(config RequestIDConfig) echo.MiddlewareFunc { | ||||
| 	if config.Generator == nil { | ||||
| 		config.Generator = generator | ||||
| 	} | ||||
| 	if config.TargetHeader == "" { | ||||
| 		config.TargetHeader = echo.HeaderXRequestID | ||||
| 	} | ||||
| 
 | ||||
| 	return func(next echo.HandlerFunc) echo.HandlerFunc { | ||||
| 		return func(c echo.Context) error { | ||||
| @ -51,11 +58,11 @@ func RequestIDWithConfig(config RequestIDConfig) echo.MiddlewareFunc { | ||||
| 
 | ||||
| 			req := c.Request() | ||||
| 			res := c.Response() | ||||
| 			rid := req.Header.Get(echo.HeaderXRequestID) | ||||
| 			rid := req.Header.Get(config.TargetHeader) | ||||
| 			if rid == "" { | ||||
| 				rid = config.Generator() | ||||
| 			} | ||||
| 			res.Header().Set(echo.HeaderXRequestID, rid) | ||||
| 			res.Header().Set(config.TargetHeader, rid) | ||||
| 			if config.RequestIDHandler != nil { | ||||
| 				config.RequestIDHandler(c, rid) | ||||
| 			} | ||||
|  | ||||
							
								
								
									
										3
									
								
								vendor/github.com/labstack/echo/v4/router.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								vendor/github.com/labstack/echo/v4/router.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @ -99,6 +99,9 @@ func (r *Router) Add(method, path string, h HandlerFunc) { | ||||
| 	for i, lcpIndex := 0, len(path); i < lcpIndex; i++ { | ||||
| 		if path[i] == ':' { | ||||
| 			if i > 0 && path[i-1] == '\\' { | ||||
| 				path = path[:i-1] + path[i:] | ||||
| 				i-- | ||||
| 				lcpIndex-- | ||||
| 				continue | ||||
| 			} | ||||
| 			j := i + 1 | ||||
|  | ||||
							
								
								
									
										4
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/modules.txt
									
									
									
									
										vendored
									
									
								
							| @ -164,11 +164,11 @@ github.com/klauspost/cpuid/v2 | ||||
| # github.com/kyokomi/emoji/v2 v2.2.8 | ||||
| ## explicit; go 1.14 | ||||
| github.com/kyokomi/emoji/v2 | ||||
| # github.com/labstack/echo/v4 v4.6.1 | ||||
| # github.com/labstack/echo/v4 v4.6.3 | ||||
| ## explicit; go 1.15 | ||||
| github.com/labstack/echo/v4 | ||||
| github.com/labstack/echo/v4/middleware | ||||
| # github.com/labstack/gommon v0.3.0 | ||||
| # github.com/labstack/gommon v0.3.1 | ||||
| ## explicit; go 1.12 | ||||
| github.com/labstack/gommon/bytes | ||||
| github.com/labstack/gommon/color | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	![49699333+dependabot[bot]@users.noreply.github.com](/assets/img/avatar_default.png) dependabot[bot]
						dependabot[bot]