Replies: 7 comments
-
Thanks for pointing this out! Unfortunately, we need Interceptors as well and it doesn't look like the built-in one supports that. Could you verify, as I may be mistaken on that point? |
Beta Was this translation helpful? Give feedback.
-
It seems like interceptors don't come out from the box, but they are easily implementable by ourselves inside a decorator, in addition a custom |
Beta Was this translation helpful? Give feedback.
-
Here's the only case where an Interceptor is used, and it's used only to add a |
Beta Was this translation helpful? Give feedback.
-
Oh, I should have mentioned we're using it here #139 and for short-circuiting/mocking endpoints in tests (.cf the test for HTTP functions in that PR). I was also going to point to the Junit runner (EdcExtension) which was supposed to allow interceptors to be added for mocking endpoints and then I saw we forgot to complete the implementation :-) |
Beta Was this translation helpful? Give feedback.
-
So at the moment there are two uses: one for the tests and one for decorating requests (quoting the
About the tests, would be easier (and maybe more meaningful for an integration test that passes through an http call) to use an http server mock library like wiremock? Because at the moment I feel that this interceptor registry is used just for mocking http endpoints, and I think we should avoid writing production code just for testing purposes. About the "decoration feature" of the interceptors, I still think we could implement that by ourselves over the java HttpClient, maybe defining just an |
Beta Was this translation helpful? Give feedback.
-
Hey, good discussion. I think writing a proxy over the HTTPClient is likely to get complicated. For example, this implementation: https://github.com/raphw/interceptable-http-client Could we keep this as something to look at in the future because replacing it now will cause a significant disruption in the codebase when a lot of other changes are going on? |
Beta Was this translation helpful? Give feedback.
-
Yes, for sure. I took a look at that implementation, I think we could make something simpler, but maybe before we should think about our actual needs. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
In the aim of having less external dependencies, could be good to replace
OkHttp
with the Java internalHttpClient
:https://openjdk.java.net/groups/net/httpclient/intro.html
Beta Was this translation helpful? Give feedback.
All reactions