fix http client generation without openapiv2 annotation

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2021-03-19 12:59:53 +03:00
parent 4d2af78ba7
commit bce3839877

View File

@ -55,15 +55,15 @@ func generateServiceClientMethods(gfile *protogen.GeneratedFile, service *protog
gfile.P("opts = append(opts,")
gfile.P(microClientHttpPackage.Ident("ErrorMap"), "(errmap),")
gfile.P(")")
}
if proto.HasExtension(method.Desc.Options(), api_options.E_Http) {
gfile.P("opts = append(opts,")
endpoints, _ := generateEndpoints(method)
path, method, body := getEndpoint(endpoints[0])
gfile.P(microClientHttpPackage.Ident("Method"), `("`, method, `"),`)
gfile.P(microClientHttpPackage.Ident("Path"), `("`, path, `"),`)
gfile.P(microClientHttpPackage.Ident("Body"), `("`, body, `"),`)
}
gfile.P(")")
}
}