googleapis / googleapis/google-http-java-client

HttpClient RequestConfig cannot be set

Aperta
#1,107 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
type: feature request
Lingua principale
Java
Stelle
1.4k
Fork
473
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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?

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.