com.gargoylesoftware.htmlunit.WebClient.removeRequestHeader()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(1.1k)|赞(0)|评价(0)|浏览(165)

本文整理了Java中com.gargoylesoftware.htmlunit.WebClient.removeRequestHeader()方法的一些代码示例,展示了WebClient.removeRequestHeader()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebClient.removeRequestHeader()方法的具体详情如下:
包路径:com.gargoylesoftware.htmlunit.WebClient
类名称:WebClient
方法名:removeRequestHeader

WebClient.removeRequestHeader介绍

[英]Removes a header from being sent with EVERY request from this client.
[中]从此客户端的每个请求中删除发送的标头。

代码示例

代码示例来源:origin: out0fmemory/GuozhongCrawler

public void clearHeaders(){
  WebClient webClient = getWebClient();
  for (String name:headerNames) {
    webClient.removeRequestHeader(name);
  }
  headerNames.clear();
}

代码示例来源:origin: com.thoughtworks.inproctester/jerseytester-webdriver

@Override
public void get(String url) {
  getWebClient().addRequestHeader(HttpHeaders.ACCEPT, MediaType.TEXT_HTML);
  super.get(url);
  getWebClient().removeRequestHeader(HttpHeaders.ACCEPT);
}

代码示例来源:origin: USCDataScience/sparkler

String userAgent = getUserAgent();
if (StringUtils.isNotBlank(userAgent)) {
  driver.removeRequestHeader(USER_AGENT);
  driver.addRequestHeader(USER_AGENT, userAgent);

相关文章

WebClient类方法