File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change 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" ;
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);
You can’t perform that action at this time.
0 commit comments