googleapis / googleapis/google-http-java-client

HttpClient RequestConfig cannot be set

Đang mở
#1,107 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
type: feature request
Ngôn ngữ chính
Java
Star
1.4k
Fork
473
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.