-
-
Notifications
You must be signed in to change notification settings - Fork 108
Closed
Description
Please complete the following information:
- Library Version: 2.0.9
Describe the Bug:
It seems that Sandwich's ApiResponseConverterFactory
is treating all KtorfitResult.Success
responses as ApiResponse.Success
. However, this may not always be correct because KtorfitResult.Success
can contain HTTP responses with error status codes. Currently, the factory does not take Sandwich's successCodeRange
into account, which leads to HTTP errors being incorrectly classified as successes. Additionally, it appears that no responses are ever mapped to ApiResponse.Error
, even when the HTTP status code would suggest otherwise.
Lines 50 to 59 in 3084949
val apiResponse: ApiResponse<Any> = try { | |
when (result) { | |
is KtorfitResult.Success -> | |
ApiResponse.Success(result.response.body(typeData.typeArgs.first().typeInfo)) | |
is KtorfitResult.Failure -> ApiResponse.exception(result.throwable) | |
} | |
} catch (e: Throwable) { | |
ApiResponse.exception(e) | |
} |
Metadata
Metadata
Assignees
Labels
No labels