成人免费xxxxx在线视频软件_久久精品久久久_亚洲国产精品久久久_天天色天天色_亚洲人成一区_欧美一级欧美三级在线观看

IDEA中的輕量級接口請求工具 | HTTP Client 新手指南

開發 開發工具
HTTP Client 是 IDEA 自帶的一款簡潔輕量級的接口調用插件,通過它,我們能在 IDEA 上開發,調試,測試 RESTful Web 服務。

?一、 簡介

HTTP Client 是 IDEA 自帶的一款簡潔輕量級的接口調用插件,通過它,我們能在 IDEA 上開發,調試,測試 RESTful Web 服務。

二、 快速上手

1.首先要確保 HTTP Client 插件是安裝啟動的,默認是已安裝啟動的。若沒有安裝,在 File - Settings - Plugins 路徑下進行安裝:

圖片

2.可以在項目根目錄下創建一個存儲請求文件的文件夾,然后在里面創建HTTP Client 請求文件:

圖片

3、打開創建的文件,可以直接的點擊右上角工具欄中的add request, 選擇相應的請求類型即可添加,如下圖所示get請求: 

圖片

4、點擊左邊的運行按鈕即可發送請求,結果如下:

圖片

三、GET相關請求示例

### GET request with a header
GET https://httpbin.org/ip
Accept: application/json

### GET request with parameter
GET https://httpbin.org/get?show_env=1
Accept: application/json

### GET request with environment variables
GET {{host}}/get?show_env={{show_env}}
Accept: application/json

### GET request with disabled redirects
# @no-redirect
GET http://httpbin.org/status/301

### GET request with dynamic variables
GET http://httpbin.org/anything?id={{$uuid}}&ts={{$timestamp}}

###

四、POST相關請求示例

### Send POST request with json body
POST https://httpbin.org/post
Content-Type:application/json

{
"id": 999,
"value": "content"
}

### Send POST request with body asparameters
POST https://httpbin.org/post
Content-Type:application/x-www-form-urlencoded

id=999&value=content

### Send a form with the text and file fields
POST https://httpbin.org/post
Content-Type:multipart/form-data;boundary=WebAppBoundary

--WebAppBoundary
Content-Disposition: form-data; name="element-name"
Content-Type: text/plain

Name
--WebAppBoundary
Content-Disposition: form-data; name="data";filename="data.json"
Content-Type:application/json

< ./request-form-data.json
--WebAppBoundary--

### Send request with dynamic variables in request's body
POST https://httpbin.org/post
Content-Type:application/json

{
"id":{{$uuid}},
"price":{{$randomInt}},
"ts":{{$timestamp}},
"value": "content"
}

###

五、PUT相關請求示例

PUT http://localhost:8080/person/put
Content-Type:application/json

{"name": "name111","age": 17}

六、PATCH相關請求示例

###
PATCH http://localhost:8080/person/put
Content-Type:application/json

{"name": "demo111","age": 17}

七、帶鑒權驗證的示例

###
PATCH http://localhost:8080/person/put
Content-Type: application/json

{"name": "demo111","age": 17}
七、帶鑒權驗證的示例
### Basic authorization.
GET https://httpbin.org/basic-auth/user/passwd
Authorization: Basic user passwd

### Basic authorization with variables.
GET https://httpbin.org/basic-auth/user/passwd
Authorization: Basic {{username}} {{password}}

### Digest authorization.
GET https://httpbin.org/digest-auth/realm/user/passwd
Authorization: Digest user passwd

### Digest authorization with variables.
GET https://httpbin.org/digest-auth/realm/user/passwd
Authorization: Digest {{username}} {{password}}

### Authorization by token, part 1. Retrieve and save token.
POST https://httpbin.org/post
Content-Type: application/json

{
"token": "my-secret-token"
}

> {% client.global.set("auth_token", response.body.json.token); %}

### Authorization by token, part 2. Use token to authorize.
GET https://httpbin.org/headers
Authorization: Bearer {{auth_token}}

###

八、斷言方式請求示例

### Successful test: check response status is 200
GET https://httpbin.org/status/200

> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});
%}

### Failed test: check response status is 200
GET https://httpbin.org/status/404

> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});
%}

### Check response status and content-type
GET https://httpbin.org/get

> {%
client.test("Request executed successfully", function() {
client.assert(response.status === 200, "Response status is not 200");
});

client.test("Response content-type is json", function() {
var type = response.contentType.mimeType;
client.assert(type === "application/json", "Expected 'application/json' but received '" + type + "'");
});
%}

### Check response body
GET https://httpbin.org/get

> {%
client.test("Headers option exists", function() {
client.assert(response.body.hasOwnProperty("headers"), "Cannot find 'headers' option in response");
});
%}

###

責任編輯:武曉燕 來源: 新鈦云服
相關推薦

2022-05-16 15:37:32

開源軟件

2010-06-07 16:10:53

HadoopOnDem

2022-04-08 12:56:52

Linux終端命令

2025-01-13 07:15:00

Monorepo代碼倉庫中項目代碼管理

2009-10-10 13:21:02

服務器測試工具

2010-06-21 12:39:56

OSPF路由協議

2023-03-01 08:00:00

機器學習數據集

2010-05-27 10:42:38

SVN配置文檔

2009-11-16 08:58:43

PHP語言

2010-05-24 16:36:14

2011-03-30 14:07:56

Ubuntu的安裝

2011-08-23 10:11:10

LinuxTop命令

2010-08-04 09:06:21

Flex安裝

2023-03-15 09:46:07

R Markdown代碼語法

2021-12-30 10:26:37

Bash Shell腳本文件命令

2022-02-28 11:02:53

函數Bash Shell語句

2022-01-20 16:43:38

Bash 腳本ShellLinux

2022-12-01 15:34:26

Arch LinuxOpenOffice

2021-01-24 16:40:00

Python爬取網站編程語言

2010-05-17 11:24:33

點贊
收藏

51CTO技術棧公眾號

主站蜘蛛池模板: 日本免费在线 | 午夜av一区二区 | www.久| 亚洲精品免费视频 | 欧美在线观看黄色 | 国产精品精品久久久 | 国产激情在线播放 | 久久鲁视频 | 免费在线观看一区二区三区 | 黄网站免费在线看 | 五月婷婷导航 | 免费能直接在线观看黄的视频 | 91大神在线看 | 午夜看电影在线观看 | 看片wwwwwwwwwww| 国产精品一区二区免费看 | 蜜桃一区二区三区 | 亚洲一区二区视频 | 欧美久久久久久 | 一区二区视频 | 丝袜毛片 | 成人在线观看欧美 | 亚洲精品免费视频 | 日韩中文字幕一区二区三区 | 国产精品毛片无码 | 涩色视频在线观看 | 一区二区三区成人 | 毛片一区二区三区 | 国内精品久久久久久 | 人人干在线视频 | 精品乱码一区二区 | 亚洲福利视频一区二区 | 精品九九 | 欧美性猛交一区二区三区精品 | 九九九精品视频 | 国产三级日本三级 | 精品欧美乱码久久久久久 | 亚洲一区二区av | 国产精品资源在线 | 日韩精品一区二区三区在线播放 | 国产精品国产三级国产aⅴ中文 |