zoukankan      html  css  js  c++  java
  • 接口取值测试案例

    @RequestMapping(params="isexist")
        @ResponseBody
        @ApiOperation(value="sdss",produces="application/json",httpMethod="POST")
        public  JSONObject isexist(String content,HttpServletRequest request) { 
                String result = null;
                try {
                    ServletInputStream inputStream = null;
                    ByteArrayOutputStream outputStream = null;
                    byte[] rs = new byte[1024];
                    inputStream = request.getInputStream();
                    outputStream = new ByteArrayOutputStream();
                    int len = 0;
                    byte[] req = null;
                    while ((len = inputStream.read(rs)) != -1) {
                        outputStream.write(rs, 0, len);
                        req = outputStream.toByteArray();
                    }
                    result = new String(req, "UTF-8"); 
                }catch (Exception e){ 
                } 
            
            
             JSONObject jsonObject =new JSONObject();
             JSONArray jsonarray = new JSONArray();
             String wheresql = "";
         
    
            return jsonObject;
        }

    调取接口

     net.sf.json.JSONObject json1 = new  net.sf.json.JSONObject();
                         json1.put("content",  jsonArray2.toString()); 
                        JSONObject resp= JwtHttpUtil.httpRequest1(endpoint, "POST", json1.toString());
  • 相关阅读:
    敏捷软件开发实践-Code Review Process(转)
    随笔1
    随笔
    随笔
    低级错误
    随笔
    随笔2
    随笔
    这以前写的代码
    蛋疼的vs
  • 原文地址:https://www.cnblogs.com/xueblvip/p/12956132.html
Copyright © 2011-2022 走看看