如何捕获请求标头中动态更改的引用值

问题描述

我想在代码中添加参照值,但是当我通过检查Chrome从“网络”选项卡检查它时,参照值不是恒定的,它总是在变化。如何在代码中捕获并定义它?有没有一种方法可以将引荐来源网址设置为请求标头中的参数?

我正在通过Java使用RestAssure框架。

   RestAssured.baseURI="https://test-v2-api.mykredit.com/api/customer/light";
    //RestAssured.baseURI="https://test-v2-api.mykredit.com/api/membership";
    RequestSpecification httpRequest2 = RestAssured.given();
    JSONObject requestparam2 = new JSONObject();
    System.out.println(mobilenum.substring(5)); 
    requestparam2.put("pin",mobilenum.substring(5));
    
    httpRequest2.header("Content-Type","application/json; charset=utf-8");
    httpRequest2.body(requestparam2.toJSONString());
    
    //Response response = httpRequest2.request(Method.POST,"/login");
    Response response = httpRequest2.request(Method.POST,"/pinValidate");
    String responseBody = response.getBody().asString();
    System.out.println(responseBody);
    
    int status = response.getStatusCode();
    System.out.println("Status"+" "+status);
    Assert.assertEquals(status,200);
    
}

referer

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)