From adae8b76db8db51c431cd19c9ec6fe6ff46bc162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20K=C3=B6hler?= Date: Fri, 27 Jun 2025 09:42:04 +0200 Subject: [PATCH] Update context.go Changed from iteration to lookup Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- context.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/context.go b/context.go index 9696d56d..45f1ae7b 100644 --- a/context.go +++ b/context.go @@ -1316,11 +1316,9 @@ var negotiationRenderMappings = map[string]NegotiationRenderFunc{ func (c *Context) Negotiate(code int, config Negotiate) { accepted := c.NegotiateFormat(config.Offered...) - for bind, fn := range negotiationRenderMappings { - if bind == accepted { - fn(code, config, c) - return - } + if fn, ok := negotiationRenderMappings[accepted]; ok { + fn(code, config, c) + return } c.AbortWithError(http.StatusNotAcceptable, errors.New("the accepted formats are not offered by the server")) //nolint: errcheck