Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support not follow redirect for HTTP client #702

Merged
merged 11 commits into from May 1, 2020
7 changes: 6 additions & 1 deletion codegen/template_bundle/template_files.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions codegen/templates/http_client.tmpl
Expand Up @@ -90,6 +90,10 @@ func {{$exportName}}(deps *module.Dependencies) Client {
if deps.Default.Config.ContainsKey("http.clients.requestUUIDHeaderKey") {
requestUUIDHeaderKey = deps.Default.Config.MustGetString("http.clients.requestUUIDHeaderKey")
}
followRedirect := true
if deps.Default.Config.ContainsKey("clients.{{$clientID}}.followRedirect") {
followRedirect = deps.Default.Config.MustGetBoolean("clients.{{$clientID}}.followRedirect")
}


circuitBreakerDisabled := configureCicruitBreaker(deps, timeoutVal)
Expand All @@ -113,6 +117,7 @@ func {{$exportName}}(deps *module.Dependencies) Client {
baseURL,
defaultHeaders,
timeout,
followRedirect,
),
circuitBreakerDisabled: circuitBreakerDisabled,
requestUUIDHeaderKey: requestUUIDHeaderKey,
Expand Down
1 change: 1 addition & 0 deletions codegen/test_data/clients/bar.gogen
Expand Up @@ -248,6 +248,7 @@ func NewClient(deps *module.Dependencies) Client {
baseURL,
defaultHeaders,
timeout,
true,
),
}
}
Expand Down
9 changes: 8 additions & 1 deletion examples/example-gateway/build/clients/bar/bar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions examples/example-gateway/build/clients/contacts/contacts.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions examples/example-gateway/build/clients/multi/multi.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.