org.mockserver.model.HttpResponse.withConnectionOptions()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(77)

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

HttpResponse.withConnectionOptions介绍

[英]The connection options for override the default connection behaviour, this allows full control of headers such as "Connection" or "Content-Length" or controlling whether the socket is closed after the response has been sent
[中]用于覆盖默认连接行为的连接选项,这允许完全控制诸如“连接”或“内容长度”之类的标题,或者控制在发送响应后是否关闭套接字

代码示例

代码示例来源:origin: jamesdbloom/mockserver

public HttpResponse buildObject() {
  return new HttpResponse()
    .withStatusCode(statusCode)
    .withReasonPhrase(reasonPhrase)
    .withBody(body != null ? body.buildObject() : null)
    .withHeaders(headers)
    .withCookies(cookies)
    .withDelay((delay != null ? delay.buildObject() : null))
    .withConnectionOptions((connectionOptions != null ? connectionOptions.buildObject() : null));
}

代码示例来源:origin: jamesdbloom/mockserver

public HttpResponse clone() {
    return response()
      .withStatusCode(statusCode)
      .withReasonPhrase(reasonPhrase)
      .withBody(body)
      .withHeaders(headers.clone())
      .withCookies(cookies.clone())
      .withDelay(getDelay())
      .withConnectionOptions(connectionOptions);
  }
}

代码示例来源:origin: org.mock-server/mockserver-core

public HttpResponse buildObject() {
  return new HttpResponse()
    .withStatusCode(statusCode)
    .withReasonPhrase(reasonPhrase)
    .withBody(body != null ? body.buildObject() : null)
    .withHeaders(headers)
    .withCookies(cookies)
    .withDelay((delay != null ? delay.buildObject() : null))
    .withConnectionOptions((connectionOptions != null ? connectionOptions.buildObject() : null));
}

代码示例来源:origin: org.mock-server/mockserver-core

public HttpResponse clone() {
    return response()
      .withStatusCode(statusCode)
      .withReasonPhrase(reasonPhrase)
      .withBody(body)
      .withHeaders(headers.clone())
      .withCookies(cookies.clone())
      .withDelay(getDelay())
      .withConnectionOptions(connectionOptions);
  }
}

代码示例来源:origin: tote/mockserver8

public void doResponse(ForwardChainExpectation fce, EndPoint ep){
  HttpResponse response = response().withStatusCode(ep.statusCode())
                .withConnectionOptions(new ConnectionOptions().withKeepAliveOverride(false))
                .withBody(ep.getResponseBody())
                .withHeaders(ep.getResponseHeaders());
  fce.respond(response);
}

相关文章