From ed144f6813c179b7eb0566d5b9ccb6a1377e4a1d Mon Sep 17 00:00:00 2001
From: Nikita Krasnikov <nikitaksv97@gmail.com>
Date: Mon, 16 May 2022 08:37:36 +0300
Subject: [PATCH] Fix buildMethodDesc for two and more message field (#1979)

---
 cmd/protoc-gen-go-http/http.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cmd/protoc-gen-go-http/http.go b/cmd/protoc-gen-go-http/http.go
index 4886b8061..eb3fa89e3 100644
--- a/cmd/protoc-gen-go-http/http.go
+++ b/cmd/protoc-gen-go-http/http.go
@@ -163,9 +163,10 @@ func buildMethodDesc(g *protogen.GeneratedFile, m *protogen.Method, method, path
 	defer func() { methodSets[m.GoName]++ }()
 
 	vars := buildPathVars(path)
-	fields := m.Input.Desc.Fields()
 
 	for v, s := range vars {
+		fields := m.Input.Desc.Fields()
+
 		if s != nil {
 			path = replacePath(v, *s, path)
 		}