类似postman_IDEA自带类似postman的http请求客户端你知道吗

一、前言

公司内部的其他组件,提供了rpc、http服务,而 http 服务的组件,正打算测试以下接口的方法功能,无奈电脑没有安装 postman,却偶然发现 idea 自带 http 请求客户端,界面简洁美观,功能完善,完全不逊色于postman!

二、位置

打开idea左上方的菜单 Tools -> HTTP Client -> Test RESTful Web Service

541c5510e46f8a2caa04f115c78e31fd.png

打开后的界面如下

e397e93dc117f488457a55759e3a9244.png

三、测试

简单写了一个get请求的接口

package com.cun.springboottest.controller;import com.cun.springboottest.domain.Student;import org.springframework.web.bind.annotation.GetMapping;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;import java.util.ArrayList;import java.util.List;@RestController@RequestMapping("/student")public class StudentController {    @GetMapping("/list")    public List listStudent(){        ArrayList students = new ArrayList<>();        Student jd = new Student(1, "jd", 17);        Student pdd = new Student(2, "pdd", 4);        students.add(jd);        students.add(pdd);        return students;    }}

测试请求:填写 method、host、port、path即可

复杂的场景,还可以在header里边增加参数,如最常见的 token等

7f602659e212d9a163898f11070206bd.png

可以看到,返回预期的结果!如此一来,又方便了开发测试了!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值