天天看點

ngrinder常用用法

 擷取響應頭字段@Test:

String body = "{\"userName\":\"xiaocc\",\"password\":\"l3x0raKzacb26ZeR2G0A9IoW4HtE0NKdWmFoI52cKgM=\"}"
    HTTPResponse result = request.POST("http://10.248.12.10:3462/login", body.getBytes())//發起請求
    auth=result.getHeader('authorization')//擷取響應頭中的authorization字段值      

  設定請求頭@BeforeProcess:

// 設定請求頭header
    List<NVPair> headerList = new ArrayList<NVPair>()
    headerList.add(new NVPair("Content-Type", "application/json"))
    //headerList.add(new NVPair("authorization", "Bearer"))
    headers = headerList.toArray()