postMan测试接口的几种方式

接口获取参数方式1:

    @RequestMapping(value = "/commitExam", method = RequestMethod.POST, headers = "Accept=application/json")
    @ResponseBody
    public String commitExam(HttpServletRequest request) throws Exception {
        //人员id
        String staffId = request.getParameter("staffId");
        //培训id
        String trainingId = request.getParameter("trainingId");
        //第几次考试
        String examTimes = request.getParameter("examTimes");
        //考题和选项
        String titleAndAnswer = request.getParameter("titleAndAnswer");
        //考试id
        String examId = request.getParameter("examId");
    }

postMan测试

 

接口获取参数方式2:

    @RequestMapping(value = "/selectPageConfigMenu", method = RequestMethod.POST)
    public String selectPageConfigMenu(HttpServletRequest request, @RequestBody ParamsDto paramsDto){
        logger.info("-----------------------selectPageConfigMenu接口被调用-----------------------------");
        Map map = new HashMap(16);
        List row = configPageMenuService.selectPageConfigMenu(map);
        map.put("list1", row);
        logger.info("-----------------------selectPageConfigMenu接口调用结束-----------------------------");
        return JSON.toJSONString(map);
    }

 postMan测试(参数会出现在paramsDto中)

posted @ 2019-03-27 19:41  林被熊烟岛  阅读(640)  评论(0编辑  收藏  举报