Idea插件 Http Client

Http Client

Http Client是idea的插件,它可以让你在文件中测试你的接口

简单案例:

接口

    @PostMapping("/greeting")
    public String postGreeting(@RequestBody User user) {
        return "Hello World " + "\n" + user;
    }

创建文件rest.http

// 自定义变量
@password=xxxxxxxxxxxxxxx
POST http://localhost:8080/greeting
Authorization: Basic user 792670db-3e6d-400a-b8d4-c8e4a5a86aa8
Content-Type: application/json

{"age": "99", "id":  "22659264"}
###
GET http://localhost:8080/greeting
Authorization: Basic user {{password}}

posted @ 2023-02-17 18:46  OraCat  阅读(144)  评论(0编辑  收藏  举报