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

能否支持暴露拦截器,给外部使用时传入 #69

Open
honwhy opened this issue Sep 15, 2022 · 1 comment
Open

能否支持暴露拦截器,给外部使用时传入 #69

honwhy opened this issue Sep 15, 2022 · 1 comment

Comments

@honwhy
Copy link

honwhy commented Sep 15, 2022

拦截器实现参考:https://dev.to/clavinjune/golang-http-client-interceptors-2ebe

image
不修改response_, _err := tea.DoRequest(request_, _runtime)调用方式,
设置全局拦截器。
类似Java的做法(Darabonba codegen的java项目有拦截器机制)

public class Client {

    private final static InterceptorChain interceptorChain = InterceptorChain.create();
    public Client(Config config) throws Exception {
        ...
           interceptorChain.addRequestInterceptor(new RequestInterceptor() {
            @Override
            public TeaRequest modifyRequest(InterceptorContext context, AttributeMap attributes) {
                return null;
            }
        });
    }
@yndu13
Copy link
Contributor

yndu13 commented Mar 23, 2023

好的,感谢建议,我们评估下

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants