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

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

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

HttpRequest.withQueryStringParameters介绍

[英]The query string parameters to match on as a list of Parameter objects where the values or keys of each parameter can be either a string or a regex (for more details of the supported regex syntax see http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html)
[中]要匹配的查询字符串参数作为参数对象列表,其中每个参数的值或键可以是字符串或正则表达式(有关支持的正则表达式语法的更多详细信息,请参阅http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html)

代码示例

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

private void setQueryString(HttpRequest httpRequest, HttpServletRequest httpServletRequest) {
  Parameters parameters = new Parameters();
  if (StringUtils.isNotEmpty(httpServletRequest.getQueryString())) {
    parameters.withEntries(new QueryStringDecoder("?" + httpServletRequest.getQueryString()).parameters());
  }
  httpRequest.withQueryStringParameters(parameters);
}

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

private void setQueryString(HttpRequest httpRequest, QueryStringDecoder queryStringDecoder) {
  Parameters parameters = new Parameters();
  try {
    parameters.withEntries(queryStringDecoder.parameters());
  } catch (IllegalArgumentException iae) {
    mockServerLogger.error(httpRequest, "Exception while parsing query string", iae);
  }
  httpRequest.withQueryStringParameters(parameters);
}

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

public HttpRequest buildObject() {
  return new HttpRequest()
    .withMethod(method)
    .withPath(path)
    .withQueryStringParameters(queryStringParameters)
    .withBody((body != null ? Not.not(body.buildObject(), body.getNot()) : null))
    .withHeaders(headers)
    .withCookies(cookies)
    .withSecure(secure)
    .withKeepAlive(keepAlive);
}

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

public HttpRequest clone() {
  return not(request(), not)
    .withMethod(method)
    .withPath(path)
    .withQueryStringParameters(getQueryStringParameters().clone())
    .withBody(body)
    .withHeaders(getHeaders().clone())
    .withCookies(getCookies().clone())
    .withKeepAlive(keepAlive)
    .withSecure(secure);
}

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

.withMethod("POST")
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param(string("queryStringParameterOneName"), not("Parameter One Value One"), not("Parameter One Value Two")),
  param("queryStringParameterTwoName", "Parameter Two")
.withMethod("POST")
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "OTHER Parameter One Value One", "OTHER Parameter One Value Two"),
  param("queryStringParameterTwoName", "Parameter Two")

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

.withMethod("POST")
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param(not("queryStringParameterOneName"), not("Parameter One Value One"), not("Parameter One Value Two")),
  param("queryStringParameterTwoName", "Parameter Two")
.withMethod("POST")
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "Parameter One Value One", "Parameter One Value Two"),
  param("queryStringParameterTwoName", "Parameter Two")
.withMethod("POST")
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "Parameter One Value One", "Parameter One Value Two"),
  param("queryStringParameterTwoName", "Parameter Two")

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

.withMethod("POST")
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param(not("queryStringParameterOneName"), string("Parameter One Value One"), string("Parameter One Value Two")),
  param("queryStringParameterTwoName", "Parameter Two")
.withMethod("POST")
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param("OTHERQueryStringParameterOneName", "Parameter One Value One", "Parameter One Value Two"),
  param("queryStringParameterTwoName", "Parameter Two")

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

.withMethod("POST")
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param(not("queryStringParameterOneName"), not("Parameter One Value One"), not("Parameter One Value Two")),
  param("queryStringParameterTwoName", "Parameter Two")
.withMethod("POST")
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param("OTHERQueryStringParameterOneName", "Parameter One Value One", "Parameter One Value Two"),
  param("queryStringParameterTwoName", "Parameter Two")
.withMethod("POST")
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "OTHER Parameter One Value One", "OTHER Parameter One Value Two"),
  param("queryStringParameterTwoName", "Parameter Two")

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

.withMethod("POST")
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValueOne", "queryStringParameterOneValueTwo"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")
.withMethod("POST")
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "OTHERqueryStringParameterOneValueOne", "queryStringParameterOneValueTwo"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")

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

.withMethod("POST")
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValueOne", "queryStringParameterOneValueTwo"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")
.withMethod("POST")
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param("OTHERQueryStringParameterOneName", "queryStringParameterOneValueOne", "queryStringParameterOneValueTwo"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")

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

.withMethod("POST")
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValueOne", "queryStringParameterOneValueTwo"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")
.withMethod("POST")
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValueOne", "queryStringParameterOneValueTwo"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")
.withMethod("POST")
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValueOne", "queryStringParameterOneValueTwo"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")

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

.withMethod("GET")
.withPath(calculatePath("some_path"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")
.withMethod("GET")
.withPath(calculatePath("some_path"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")
.withSecure(true)
.withPath(calculatePath("some_path"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")

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

.withMethod("GET")
.withPath(calculatePath("some_path"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")
.withMethod("GET")
.withPath(calculatePath("some_path"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")
.withSecure(true)
.withPath(calculatePath("some_path"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")

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

.withMethod("GET")
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")
.withMethod("GET")
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")
.withSecure(true)
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")

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

.withMethod("GET")
.withPath(calculatePath("some_path"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")
.withMethod("GET")
.withPath(calculatePath("some_path"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")
.withSecure(true)
.withPath(calculatePath("some_path"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")

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

.withMethod("GET")
.withPath(calculatePath("some_path"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")
.withMethod("GET")
.withPath(calculatePath("some_other_path"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")
.withSecure(true)
.withPath(calculatePath("some_other_path"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")

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

.withMethod("GET")
.withPath(calculatePath("some_path"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")
.withMethod("GET")
.withPath(calculatePath("some_path"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")
.withSecure(true)
.withPath(calculatePath("some_path"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")

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

.withMethod("GET")
.withPath(calculatePath("some_path"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")
.withMethod("GET")
.withPath(calculatePath("some_path"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")
.withSecure(true)
.withPath(calculatePath("some_path"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")

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

.withMethod("GET")
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")
.withSecure(true)
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")

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

.withMethod("POST")
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")
.withSecure(true)
.withPath(calculatePath("some_pathRequest"))
.withQueryStringParameters(
  param("queryStringParameterOneName", "queryStringParameterOneValue"),
  param("queryStringParameterTwoName", "queryStringParameterTwoValue")

相关文章