Conversation
929413e to
d686fe8
Compare
7fa7db5 to
538b974
Compare
d96a47e to
56913a4
Compare
|
This PR/issue depends on:
|
49f6d15 to
d85419f
Compare
|
The refactoring improves the networking architecture by centralizing environment configuration in ApiClientProvider using Ktor's defaultRequest plugin, eliminating the redundant BaseRequest abstraction and simplifying repository constructors. The migration to direct HttpClient usage with extension functions provides cleaner request syntax, though the deletePasskey method inconsistently uses a hardcoded URL path instead of ApiRoutes constants like other endpoints. #ai-review-summary |
| // When you don't use AuthenticatorInjection, you don't have an userAgent, so we're currently setting a default value. | ||
| // See later how to improve it. | ||
| private val userAgent: String = "Ktor client", | ||
| class ApiClientProvider constructor( |
There was a problem hiding this comment.
Class visibility changed from 'internal' to 'public' - confirm this exposure to public API is intentional.
| class ApiClientProvider constructor( | |
| internal class ApiClientProvider constructor( |
#ai-review-inline
| coerceInputValues = true // Use default values if not recognized (used for enums). | ||
| ignoreUnknownKeys = true // Don't break if keys are added. | ||
| @OptIn(ExperimentalSerializationApi::class) | ||
| decodeEnumsCaseInsensitive = true |
There was a problem hiding this comment.
Missing 'useAlternativeNames = false' setting from previous JSON configuration, which may change serialization behavior for classes with @SerialName annotations.
| decodeEnumsCaseInsensitive = true | |
| decodeEnumsCaseInsensitive = true | |
| useAlternativeNames = false |
#ai-review-inline
| // When you don't use AuthenticatorInjection, you don't have an userAgent, so we're currently setting a default value. | ||
| // See later how to improve it. | ||
| private val userAgent: String = "Ktor client", | ||
| class ApiClientProvider constructor( |
There was a problem hiding this comment.
Removal of HttpClientEngine parameter reduces testability by preventing injection of mock/test engines.
#ai-review-inline
|
|
||
| suspend fun deletePasskey(token: String, passkeyId: String) { | ||
| return delete(createUrl("users/me/passkeys/$passkeyId"), appendHeaders = { | ||
| httpClient.delete(Url("users/me/passkeys/$passkeyId")) { |
There was a problem hiding this comment.
Inconsistent response handling: 'deletePasskey' does not decode the response or handle errors like other methods (get/challenge/verify).
| httpClient.delete(Url("users/me/passkeys/$passkeyId")) { | |
| httpClient.delete(Url("users/me/passkeys/$passkeyId")) { | |
| addAuthenticationHeader(token) | |
| }.decode<Unit>() |
#ai-review-inline
depends on #41