Skip to content

Commit b62cda7

Browse files
committed
update doc
1 parent 234d59f commit b62cda7

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,19 @@
55

66
## 使用方法
77

8+
### 两种传输URL方式
9+
```java
10+
// 第一种
11+
String url = "http://huangty.com";
12+
Requests requests = new Requests(url);
13+
String response = requests.get().text;
14+
// 第二次
15+
String url = "http://huangty.com";
16+
Requests requests = new Requests();
17+
String response = requests.get(url).text;
18+
19+
```
20+
821
### 普通请求
922
```java
1023
String url = "http://huangty.com";
@@ -30,7 +43,15 @@
3043
```java
3144
String url = "http://huangty.com";
3245
Requests requests = new Requests();
33-
requests.addHeader("Content-Type", "application/json;charset=utf-8");
46+
List<Map<String, String>> headers = new ArrayList<Map<String, String>>();
47+
HashMap<String, String> header = new HashMap<String, String>(){
48+
{
49+
put("Content-Type", "application/json;charset=utf-8");
50+
// ...
51+
}
52+
};
53+
headers.add(header);
54+
requestss.headers = headers;
3455
String response = requests.get(url).text;
3556
// String response = requests.post(url).text;
3657
System.out.println(response);

0 commit comments

Comments
 (0)