# hongyangandroid/okhttputils

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/hongyangandroid-okhttputils).**

6,842 stars · 2,367 forks · Java · Apache-2.0

## Links

- GitHub: https://github.com/hongyangAndroid/okhttputils
- Homepage: http://blog.csdn.net/lmj623565791/article/details/47911083
- awesome-repositories: https://awesome-repositories.com/repository/hongyangandroid-okhttputils.md

## Description

OkHttpUtils is a convenience wrapper for the OkHttp HTTP client that simplifies common networking operations on Android. It provides a straightforward interface for executing GET and POST requests, including sending form parameters and JSON payloads, as well as uploading files via multipart form data and downloading remote files to local storage.

The library distinguishes itself through a set of practical utilities built on top of OkHttp's core architecture. It wraps synchronous calls into an asynchronous callback pattern, includes an interceptor-based logging layer for request and response details, and offers a custom SSL trust manager for handling self-signed or custom certificates. Cookie persistence is handled via an interceptor that saves session and persistent cookies to disk, while file transfers are augmented with progress reporting that tracks upload and download progress as a decimal ratio. Request lifecycle control is provided through tag-based cancellation, allowing active HTTP requests to be grouped and cancelled together.

Additional capabilities include a JSON body serialization helper for POST requests, a multipart form data builder for constructing complex uploads, and the ability to fetch and display remote images as bitmaps. The library also supports configuring HTTPS connections with custom certificates and persisting cookies across application restarts to maintain session state.

## Tags

### Mobile Development

- [Android Network Programming](https://awesome-repositories.com/f/mobile-development/android-network-programming.md) — Provides an Android HTTP networking wrapper for GET, POST, JSON, and multipart uploads.

### Networking & Communication

- [HTTP Client Wrappers](https://awesome-repositories.com/f/networking-communication/http-client-wrappers.md) — Ships a convenience wrapper that simplifies common HTTP operations like GET, POST, file upload, and download using OkHttp.
- [GET Request Executions](https://awesome-repositories.com/f/networking-communication/http-request-customization/request-execution/get-request-executions.md) — Provides a primary interface for executing HTTP GET requests with query parameters. ([source](https://cdn.jsdelivr.net/gh/hongyangandroid/okhttputils@master/README.md))
- [POST Request Executions](https://awesome-repositories.com/f/networking-communication/http-request-customization/request-execution/post-request-executions.md) — Provides a primary interface for executing HTTP POST requests with form parameters. ([source](https://cdn.jsdelivr.net/gh/hongyangandroid/okhttputils@master/README.md))
- [Tag-Based Cancellations](https://awesome-repositories.com/f/networking-communication/network-request-clients/request-cancellations/tag-based-cancellations.md) — Provides tag-based request cancellation to prevent network leaks when Android components are destroyed.
- [Request Cancellations](https://awesome-repositories.com/f/networking-communication/network-request-clients/request-cancellations.md) — Cancels active HTTP requests grouped by a user-assigned tag for lifecycle management. ([source](https://cdn.jsdelivr.net/gh/hongyangandroid/okhttputils@master/README.md))
- [Progress-Tracking File Downloads](https://awesome-repositories.com/f/networking-communication/remote-file-downloads/progress-tracking-file-downloads.md) — Downloads files from URLs to local storage with progress tracking and cancellation.
- [URL File Downloads](https://awesome-repositories.com/f/networking-communication/remote-file-downloads/progress-tracking-file-downloads/cloud-file-downloads/url-file-downloads.md) — Downloads files from URLs to local storage with progress tracking and cancellation support. ([source](https://cdn.jsdelivr.net/gh/hongyangandroid/okhttputils@master/README.md))
- [Decimal Progress Reports](https://awesome-repositories.com/f/networking-communication/upload-progress-tracking/progress-tracked-uploads/decimal-progress-reports.md) — Reports file upload and download progress as a decimal value between zero and one. ([source](https://cdn.jsdelivr.net/gh/hongyangandroid/okhttputils@master/README.md))

### Data & Databases

- [JSON Request Serializers](https://awesome-repositories.com/f/data-databases/json-request-serializers.md) — Serializes Java objects into JSON request bodies for HTTP POST requests. ([source](https://cdn.jsdelivr.net/gh/hongyangandroid/okhttputils@master/README.md))
- [Transfer Progress Reporters](https://awesome-repositories.com/f/data-databases/reporting-tools/contextual-progress-reporters/transfer-progress-reporters.md) — Reports upload and download progress as a decimal ratio via stream wrappers.

### Security & Cryptography

- [Development SSL Certificates](https://awesome-repositories.com/f/security-cryptography/development-ssl-certificates.md) — Handles custom or self-signed SSL certificates for secure Android network connections.
- [Session-Cookie Persistences](https://awesome-repositories.com/f/security-cryptography/session-cookie-handlers/session-cookie-persistences.md) — Persists session and persistent cookies to disk via an OkHttp interceptor.
- [HTTP Cookie Persistence](https://awesome-repositories.com/f/security-cryptography/session-persistence-strategies/client-session-persistence/download-session-persistence/http-cookie-persistence.md) — Persists cookies across app restarts to maintain session state in Android HTTP clients.
- [Custom Trust Managers](https://awesome-repositories.com/f/security-cryptography/ssl-certificate-automation/custom-certificate-overrides/custom-trust-managers.md) — Configures HTTPS connections to accept self-signed or custom SSL certificates via a custom trust manager. ([source](https://cdn.jsdelivr.net/gh/hongyangandroid/okhttputils@master/README.md))
- [SSL Certificate Validation Overrides](https://awesome-repositories.com/f/security-cryptography/ssl-certificate-validation-overrides.md) — Overrides default SSL verification with a custom trust manager for self-signed certificates.

### Web Development

- [Interceptor-Based Loggers](https://awesome-repositories.com/f/web-development/http-request-interceptors/interceptor-based-loggers.md) — Logs HTTP request and response details using an interceptor-based logging layer. ([source](https://cdn.jsdelivr.net/gh/hongyangandroid/okhttputils@master/README.md))
- [Multipart Form Uploads](https://awesome-repositories.com/f/web-development/multipart-form-uploads.md) — Uploads files via multipart form POST requests with progress reporting. ([source](https://cdn.jsdelivr.net/gh/hongyangandroid/okhttputils@master/README.md))
- [Request-Response Interceptors](https://awesome-repositories.com/f/web-development/request-response-interceptors.md) — Logs HTTP request and response details via a custom OkHttp interceptor.
