private String getCookieHeader(HttpRequest request) { List<Cookie> cookies = new ArrayList<Cookie>(); for (org.mockserver.model.Cookie cookie : request.getCookieList()) { cookies.add(new DefaultCookie(cookie.getName().getValue(), cookie.getValue().getValue())); } if (cookies.size() > 0) { return " -H '" + COOKIE + ": " + ClientCookieEncoder.LAX.encode(cookies) + "'"; } else { return ""; } } }
private void setCookies(HttpRequest httpRequest, FullHttpRequest request) { List<io.netty.handler.codec.http.cookie.Cookie> cookies = new ArrayList<io.netty.handler.codec.http.cookie.Cookie>(); for (org.mockserver.model.Cookie cookie : httpRequest.getCookieList()) { cookies.add(new io.netty.handler.codec.http.cookie.DefaultCookie(cookie.getName().getValue(), cookie.getValue().getValue())); } if (cookies.size() > 0) { request.headers().set( COOKIE.toString(), io.netty.handler.codec.http.cookie.ClientCookieEncoder.LAX.encode(cookies) ); } }
jgen.writeObjectField("headers", httpRequest.getHeaders()); if (httpRequest.getCookieList() != null && !httpRequest.getCookieList().isEmpty()) { jgen.writeObjectField("cookies", httpRequest.getCookies());
outputCookies(numberOfSpacesToIndent + 1, output, request.getCookieList()); outputQueryStringParameter(numberOfSpacesToIndent + 1, output, request.getQueryStringParameterList()); if (request.isSecure() != null) {
public HttpRequestTemplateObject(HttpRequest httpRequest) { if (httpRequest != null) { method = httpRequest.getMethod().getValue(); path = httpRequest.getPath().getValue(); for (Header header : httpRequest.getHeaderList()) { headers.put(header.getName().getValue(), Lists.transform(header.getValues(), new Function<NottableString, String>() { public String apply(NottableString input) { return input.getValue(); } })); } for (Cookie cookie : httpRequest.getCookieList()) { cookies.put(cookie.getName().getValue(), cookie.getValue().getValue()); } for (Parameter parameter : httpRequest.getQueryStringParameterList()) { queryStringParameters.put(parameter.getName().getValue(), Lists.transform(parameter.getValues(), new Function<NottableString, String>() { public String apply(NottableString input) { return input.getValue(); } })); } body = BodyDTO.createDTO(httpRequest.getBody()); keepAlive = httpRequest.isKeepAlive(); secure = httpRequest.isSecure(); } }
public HttpRequest update(HttpRequest replaceRequest) { if (!Strings.isNullOrEmpty(replaceRequest.getMethod().getValue())) { withMethod(replaceRequest.getMethod()); } if (!Strings.isNullOrEmpty(replaceRequest.getPath().getValue())) { withPath(replaceRequest.getPath()); } for (Header header : replaceRequest.getHeaderList()) { getHeaders().replaceEntry(header); } for (Cookie cookie : replaceRequest.getCookieList()) { withCookie(cookie); } for (Parameter parameter : replaceRequest.getQueryStringParameterList()) { getQueryStringParameters().replaceEntry(parameter); } if (replaceRequest.getBody() != null) { withBody(replaceRequest.getBody()); } if (replaceRequest.isSecure() != null) { withSecure(replaceRequest.isSecure()); } if (replaceRequest.isKeepAlive() != null) { withKeepAlive(replaceRequest.isKeepAlive()); } return this; } }
private String getCookieHeader(HttpRequest request) { List<Cookie> cookies = new ArrayList<Cookie>(); for (org.mockserver.model.Cookie cookie : request.getCookieList()) { cookies.add(new DefaultCookie(cookie.getName().getValue(), cookie.getValue().getValue())); } if (cookies.size() > 0) { return " -H '" + COOKIE + ": " + ClientCookieEncoder.LAX.encode(cookies) + "'"; } else { return ""; } } }
private void setCookies(HttpRequest httpRequest, FullHttpRequest request) { List<io.netty.handler.codec.http.cookie.Cookie> cookies = new ArrayList<io.netty.handler.codec.http.cookie.Cookie>(); for (org.mockserver.model.Cookie cookie : httpRequest.getCookieList()) { cookies.add(new io.netty.handler.codec.http.cookie.DefaultCookie(cookie.getName().getValue(), cookie.getValue().getValue())); } if (cookies.size() > 0) { request.headers().set( COOKIE.toString(), io.netty.handler.codec.http.cookie.ClientCookieEncoder.LAX.encode(cookies) ); } }
jgen.writeObjectField("headers", httpRequest.getHeaders()); if (httpRequest.getCookieList() != null && !httpRequest.getCookieList().isEmpty()) { jgen.writeObjectField("cookies", httpRequest.getCookies());
outputCookies(numberOfSpacesToIndent + 1, output, request.getCookieList()); outputQueryStringParameter(numberOfSpacesToIndent + 1, output, request.getQueryStringParameterList()); if (request.isSecure() != null) {
public HttpRequestTemplateObject(HttpRequest httpRequest) { if (httpRequest != null) { method = httpRequest.getMethod().getValue(); path = httpRequest.getPath().getValue(); for (Header header : httpRequest.getHeaderList()) { headers.put(header.getName().getValue(), Lists.transform(header.getValues(), new Function<NottableString, String>() { public String apply(NottableString input) { return input.getValue(); } })); } for (Cookie cookie : httpRequest.getCookieList()) { cookies.put(cookie.getName().getValue(), cookie.getValue().getValue()); } for (Parameter parameter : httpRequest.getQueryStringParameterList()) { queryStringParameters.put(parameter.getName().getValue(), Lists.transform(parameter.getValues(), new Function<NottableString, String>() { public String apply(NottableString input) { return input.getValue(); } })); } body = BodyDTO.createDTO(httpRequest.getBody()); keepAlive = httpRequest.isKeepAlive(); secure = httpRequest.isSecure(); } }
public HttpRequest update(HttpRequest replaceRequest) { if (!Strings.isNullOrEmpty(replaceRequest.getMethod().getValue())) { withMethod(replaceRequest.getMethod()); } if (!Strings.isNullOrEmpty(replaceRequest.getPath().getValue())) { withPath(replaceRequest.getPath()); } for (Header header : replaceRequest.getHeaderList()) { getHeaders().replaceEntry(header); } for (Cookie cookie : replaceRequest.getCookieList()) { withCookie(cookie); } for (Parameter parameter : replaceRequest.getQueryStringParameterList()) { getQueryStringParameters().replaceEntry(parameter); } if (replaceRequest.getBody() != null) { withBody(replaceRequest.getBody()); } if (replaceRequest.isSecure() != null) { withSecure(replaceRequest.isSecure()); } if (replaceRequest.isKeepAlive() != null) { withKeepAlive(replaceRequest.isKeepAlive()); } return this; } }