Class EasyHttp
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> io.reactivex.rxjava3.core.Observable<T>Make a HTTP call which returns a observable.static <T> TMake a HTTP call which returns a response.static voidinstallEasyHttpImplementation(IEasyHttpImplementation easyHttpImplementor) This is a method to setup you custom EasyHttpObject.static voidSetup EasyHttp to make HTTP requestsstatic voidSetup EasyHttp to make HTTP requestsstatic voidshutdown()Free all resources
-
Constructor Details
-
EasyHttp
public EasyHttp()
-
-
Method Details
-
installEasyHttpImplementation
This is a method to setup you custom EasyHttpObject. It is mainly helpful in test cases. -
setup
Setup EasyHttp to make HTTP requests -
setup
Setup EasyHttp to make HTTP requests -
shutdown
public static void shutdown()Free all resources -
callSync
Make a HTTP call which returns a response. Note - to check for timeout errors you must catch bothEasyHttpExceptions.EasyResilienceRequestTimeoutExceptionandEasyHttpExceptions.EasyRequestTimeOutException- Type Parameters:
T- type of response- Parameters:
call- request object- Returns:
- response of http call
- Throws:
EasyHttpExceptions.EasyHttpRequestException- if error, it providesEasyHttpExceptions.EasyHttpRequestException. You can catch specific type of errors by caching sub-class of EasyHttpRequestException. e.g.EasyHttpExceptions.EasyInternalServerErrorException,EasyHttpExceptions.EasyBadRequestExceptionIt also throws
EasyHttpExceptions.EasyResilienceExceptionwhich is also a sub-class ofEasyHttpExceptions.EasyHttpRequestException. These resilience exception are thrown when circuit is open, too many calls are made, or request timed out.
-
callAsync
Make a HTTP call which returns a observable. Note - to check for timeout errors you must catch bothEasyHttpExceptions.EasyResilienceRequestTimeoutExceptionandEasyHttpExceptions.EasyRequestTimeOutException- Type Parameters:
T- type of response- Parameters:
call- request object- Returns:
- observable for response of http call
- Throws:
EasyHttpExceptions.EasyHttpRequestException- (exceptions will be received in the onError callback in subscriber) if error, it providesEasyHttpExceptions.EasyHttpRequestException. You can catch specific type of errors by caching sub-class of EasyHttpRequestException. e.g.EasyHttpExceptions.EasyInternalServerErrorException,EasyHttpExceptions.EasyBadRequestExceptionIt also throws
EasyHttpExceptions.EasyResilienceExceptionwhich is also a sub-class ofEasyHttpExceptions.EasyHttpRequestException. These resilience exception are thrown when circuit is open, too many calls are made, or request timed out.
-