# okhttp-RxHttp **Repository Path**: mirrors_liujingxing/okhttp-RxHttp ## Basic Information - **Project Name**: okhttp-RxHttp - **Description**: 🔥🔥🔥 Based on OkHttp encapsulation, support Kotlin Coroutines、RxJava2、RxJava3; 30s to get started. - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2020-08-09 - **Last Updated**: 2025-11-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # RxHttp [English](https://github.com/liujingxing/rxhttp/blob/master/README.md) | 中文文档 [](https://jitpack.io/#liujingxing/rxhttp)  [](https://github.com/liujingxing/rxhttp/wiki/%E6%9B%B4%E6%96%B0%E6%97%A5%E5%BF%97) [](https://github.com/liujingxing/rxhttp/wiki/FAQ) [](https://juejin.cn/user/272334612601559/posts) # [(RxHttp 3.0 更新指南,升级必看)](https://github.com/liujingxing/rxhttp/wiki/RxHttp-3.0-%E6%9B%B4%E6%96%B0%E6%8C%87%E5%8D%97%EF%BC%8C%E5%8D%87%E7%BA%A7%E5%BF%85%E7%9C%8B) ***加我微信 ljx-studio 拉你进微信群(备注RxHttp)*** # 1、主要优势 ***1. 30秒即可上手,学习成本极低*** ***2. 史上最优雅的支持 Kotlin 协程*** ***3. 史上最优雅的处理多个BaseUrl及动态BaseUrl*** ***4. 史上最优雅的对错误统一处理,且不打破Lambda表达式*** ***5. 史上最优雅的文件上传/下载/断点下载/进度监听,已适配Android 10*** ***6. 支持Gson、Xml、ProtoBuf、FastJson等第三方数据解析工具*** ***7. 支持Get、Post、Put、Delete等任意请求方式,可自定义请求方式*** ***8. 支持在Activity/Fragment/View/ViewModel/任意类中,自动关闭请求*** ***9. 支持全局加解密、添加公共参数及头部、网络缓存,均支持对某个请求单独设置*** # 2、请求三部曲  ***代码表示, [toObservableXxx、toAwaitXxx、toFlowXxx方法介绍点这里](https://github.com/liujingxing/rxhttp/wiki/RxJava%E3%80%81Await%E3%80%81Flow-%E5%AF%B9%E5%BA%94%E7%9A%84-asXxx%E3%80%81toXxx%E3%80%81toFlowXxx%E6%96%B9%E6%B3%95%E4%BB%8B%E7%BB%8D)***
| Await | Flow | RxJava (Kotlin) |
RxJava (Java) |
|---|---|---|---|
|
```java
//同步式写法
val user = RxHttp.get("/server/..")
.add("key", "value")
.toAwait |
```java
RxHttp.get("/server/..")
.add("key", "value")
.toFlow |
```java
RxHttp.get("/server/..")
.add("key", "value")
.toObservable |
```java RxHttp.get("/server/..") .add("key", "value") .toObservable(User.class) .subscribe(user - > { //成功回调 }, throwable -> { //异常回调 }) ``` |
> 更多功能,请[下载apk](https://github.com/liujingxing/rxhttp/blob/master/screen/app-debug.apk)体验
# 7、Donations
如果它对你帮助很大,并且你很想支持库的后续开发和维护,那么你可以扫下方二维码随意打赏我,就当是请我喝杯咖啡或是啤酒,开源不易,感激不尽

# Licenses
```
Copyright 2019 liujingxing
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```