-
Notifications
You must be signed in to change notification settings - Fork 173
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
feat(retrofit): add support for retrofit2 clients that handle errors by generating Spinnaker(Server|Http|Network)Exceptions #1004
feat(retrofit): add support for retrofit2 clients that handle errors by generating Spinnaker(Server|Http|Network)Exceptions #1004
Conversation
The following commits need their title changed:
Please format your commit title into the form:
This allows us to easily generate changelogs & determine semantic version numbers when cutting releases. You can read more about commit conventions here. |
eb2662e
to
054c43b
Compare
...c/main/java/com/netflix/spinnaker/kork/retrofit/ErrorHandlingExecutorCallAdapterFactory.java
Outdated
Show resolved
Hide resolved
...fit/src/main/java/com/netflix/spinnaker/kork/retrofit/exceptions/SpinnakerHttpException.java
Outdated
Show resolved
Hide resolved
...c/main/java/com/netflix/spinnaker/kork/retrofit/ErrorHandlingExecutorCallAdapterFactory.java
Outdated
Show resolved
Hide resolved
e33e64d
to
c56317b
Compare
...t/java/com/netflix/spinnaker/kork/retrofit/exceptions/SpinnakerRetrofitErrorHandlerTest.java
Outdated
Show resolved
Hide resolved
kork-retrofit/src/main/java/com/netflix/spinnaker/kork/retrofit/Retrofit2SyncCall.java
Show resolved
Hide resolved
...fit/src/main/java/com/netflix/spinnaker/kork/retrofit/exceptions/SpinnakerHttpException.java
Show resolved
Hide resolved
...fit/src/main/java/com/netflix/spinnaker/kork/retrofit/exceptions/SpinnakerHttpException.java
Outdated
Show resolved
Hide resolved
...fit/src/main/java/com/netflix/spinnaker/kork/retrofit/exceptions/SpinnakerHttpException.java
Show resolved
Hide resolved
82199c2
to
f1d7c93
Compare
f1d7c93
to
24dba74
Compare
...ofit/src/test/java/com/netflix/spinnaker/kork/retrofit/exceptions/Retrofit2SyncCallTest.java
Outdated
Show resolved
Hide resolved
.../java/com/netflix/spinnaker/kork/retrofit/exceptions/SpinnakerRetrofitExceptionHandlers.java
Outdated
Show resolved
Hide resolved
...fit/src/main/java/com/netflix/spinnaker/kork/retrofit/exceptions/SpinnakerHttpException.java
Outdated
Show resolved
Hide resolved
21e462f
to
ed832ce
Compare
…etrofit2 auth headers
…from groovy to java
…etrofit2 auth headers
25fc172
to
142519a
Compare
kork-web/src/main/groovy/com/netflix/spinnaker/config/OkHttp3ClientConfiguration.groovy
Outdated
Show resolved
Hide resolved
kork-web/src/main/groovy/com/netflix/spinnaker/config/OkHttp3ClientConfiguration.groovy
Outdated
Show resolved
Hide resolved
Co-authored-by: David Byron <[email protected]>
8525955
to
83a6378
Compare
kork-web/src/main/groovy/com/netflix/spinnaker/retrofit/Retrofit2ConfigurationProperties.java
Outdated
Show resolved
Hide resolved
kork-web/src/main/groovy/com/netflix/spinnaker/retrofit/Retrofit2ConfigurationProperties.java
Show resolved
Hide resolved
83a6378
to
7f91fd0
Compare
now that spinnaker#1004 introduced a HttpLoggingInterceptor.Level bean in kork-web's RetrofitConfiguration class
With the addition of the okHttp3 request interceptor `SpinnakerRequestHeaderInterceptor` in spinnaker#1004 having retrofit1 add `X-SPINNAKER-*` headers is now redundant, this results in the headers being added twice to all retrofit1 client requests.
With the addition of the okHttp3 request interceptor `SpinnakerRequestHeaderInterceptor` in spinnaker#1004 having retrofit1 add `X-SPINNAKER-*` headers is now redundant, this results in the headers being added twice to all retrofit1 client requests.
With the addition of the okHttp3 request interceptor `SpinnakerRequestHeaderInterceptor` in spinnaker#1004 having retrofit1 add `X-SPINNAKER-*` headers is now redundant, this results in the headers being added twice to all retrofit1 client requests.
With the addition of the okHttp3 request interceptor `SpinnakerRequestHeaderInterceptor` in spinnaker#1004 having retrofit1 add `X-SPINNAKER-*` headers is now redundant, this results in the headers being added twice to all retrofit1 client requests.
With the addition of the okHttp3 request interceptor `SpinnakerRequestHeaderInterceptor` in spinnaker#1004 having retrofit1 add `X-SPINNAKER-*` headers is now redundant, this results in the headers being added twice to all retrofit1 client requests.
With the addition of the okHttp3 request interceptor `SpinnakerRequestHeaderInterceptor` in spinnaker#1004 having retrofit1 add `X-SPINNAKER-*` headers is now redundant, this results in the headers being added twice to all retrofit1 client requests.
With the addition of the okHttp3 request interceptor `SpinnakerRequestHeaderInterceptor` in spinnaker#1004 having retrofit1 add `X-SPINNAKER-*` headers is now redundant, this results in the headers being added twice to all retrofit1 client requests.
Global Error handling approach for changing from retrofit 1.9 to retrofit 2.x version
Creating Custom callAdaptor to handle the failure and throw Custom exception using retrofit2 response
This will be used throw the exceptions SpinnakerHttpException, SpinnakerNetworkException and SpinnakerServerException based on response status. So this will help in handling exception/error globally
References for ErrorHandler:
https://github.com/square/retrofit/blob/parent-2.8.1/samples/src/main/java/com/example/retrofit/ErrorHandlingAdapter.java
https://github.com/square/retrofit/blob/parent-2.8.1/retrofit/src/main/java/retrofit2/DefaultCallAdapterFactory.java
Retrofit2 client with error handler sample:-
Retrofit2 API sample:
Use of Retrofit2 client call sample:
ResponseBody findResponse = Retrofit2SyncCall.execute(svc.find("name"))
Note:
New property which added to support the loglevel of retrofit2 client call, default to BASIC level