What problem does it solve?
This Skill provides expert guidance to architect and implement multiplatform HTTP clients using Ktor, simplifying setup, authentication, serialization, and error handling across common targets.
Core Features & Use Cases
- Unified Client Setup: Create a reusable HttpClient with shared configuration across platforms (commonMain, androidMain, iosMain, jvmMain).
- Authentication & Security: Implement bearer tokens, token refresh, and secure storage integration for API access.
- Serialization & Interceptors: Configure content negotiation, logging, timeouts, and retry policies; customize via plugins.
- WebSocket & File Transfers: Support WebSocket communication and multipart file upload/download patterns.
- Testing & Mocking: Provide mock testing patterns for API services using MockEngine in tests.
Quick Start
Start by adding Ktor dependencies to your multiplatform module, create a shared HttpClient with content negotiation and timeouts, then wire up authentication and a basic API service. Extend with WebSocket, file upload/download, and testing blocks as needed.