googleapis / googleapis/google-http-java-client

HttpClient RequestConfig cannot be set

未关闭
#1,107 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
type: feature request
主要语言
Java
星标
1.4k
派生
473
PR 合并指标
30 天内没有已合并 PR

描述

AWS ALB sticky sessions use a cookie format that is not compatible with the default Apache HttpClient cookie specification.

The remedy for this is to provide a RequestConfig with CookieSpec set to CookieSpecs.STANDARD. But, there appears to be no way for such a RequestConfig to be actually used in this library.

Currently, I use the following mechanism attempting to provide a RequestConfig:

```
var builder = ApacheHttpTransport
.newDefaultHttpClientBuilder()
.setDefaultRequestConfig(RequestConfig.custom().setCookieSpec(CookieSpecs.STANDARD).build());
HTTP_TRANSPORT = new ApacheHttpTransport(builder.build());
...
RequestFactoryPlain = HTTP_TRANSPORT.createRequestFactory();
...
HttpRequest request = RequestFactoryPlain.buildRequest(method, url, content);
```

This RequestConfig is however not used, as the ApacheHttpRequest constructor creates a custom request configuration for every request, preventing the HttpClient default request config from being used.

Is there a different mechanism that would allow me to provide a baseline RequestConfig? If not, can one be added - potentially by using the provided HttpClient RequestConfig as a baseline instead of ignoring it and overwriting the values in ApacheHttpRequest ctor?

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。