private void setCookies(HttpResponse httpResponse) { Cookies cookies = new Cookies(); for (Header header : httpResponse.getHeaderList()) { if (header.getName().getValue().equalsIgnoreCase("Set-Cookie")) { for (NottableString cookieHeader : header.getValues()) { io.netty.handler.codec.http.cookie.Cookie httpCookie = ClientCookieDecoder.LAX.decode(cookieHeader.getValue()); String name = httpCookie.name().trim(); String value = httpCookie.value().trim(); cookies.withEntry(new Cookie(name, value)); } } if (header.getName().getValue().equalsIgnoreCase("Cookie")) { for (NottableString cookieHeader : header.getValues()) { for (io.netty.handler.codec.http.cookie.Cookie httpCookie : ServerCookieDecoder.LAX.decode(cookieHeader.getValue())) { String name = httpCookie.name().trim(); String value = httpCookie.value().trim(); cookies.withEntry(new Cookie(name, value)); } } } } if (!cookies.isEmpty()) { httpResponse.withCookies(cookies); } }
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)); }
public HttpResponse clone() { return response() .withStatusCode(statusCode) .withReasonPhrase(reasonPhrase) .withBody(body) .withHeaders(headers.clone()) .withCookies(cookies.clone()) .withDelay(getDelay()) .withConnectionOptions(connectionOptions); } }
.withReasonPhrase(HttpStatusCode.ACCEPTED_202.reasonPhrase()) .withBody("some_body_response") .withCookies(cookie("cookieNameResponse", "cookieValueResponse")) ); .withReasonPhrase(HttpStatusCode.ACCEPTED_202.reasonPhrase()) .withBody("some_body_response") .withCookies(cookie("cookieNameResponse", "cookieValueResponse")) .withHeaders( header(SET_COOKIE.toString(), "cookieNameResponse=cookieValueResponse") .withReasonPhrase(HttpStatusCode.ACCEPTED_202.reasonPhrase()) .withBody("some_body_response") .withCookies(cookie("cookieNameResponse", "cookieValueResponse")) .withHeaders( header(SET_COOKIE.toString(), "cookieNameResponse=cookieValueResponse")
.withReasonPhrase(HttpStatusCode.ACCEPTED_202.reasonPhrase()) .withBody("some_body_response") .withCookies(cookie("cookieNameResponse", "cookieValueResponse")) ); .withReasonPhrase(HttpStatusCode.ACCEPTED_202.reasonPhrase()) .withBody("some_body_response") .withCookies(cookie("cookieNameResponse", "cookieValueResponse")) .withHeaders( header(SET_COOKIE.toString(), "cookieNameResponse=cookieValueResponse") .withReasonPhrase(HttpStatusCode.ACCEPTED_202.reasonPhrase()) .withBody("some_body_response") .withCookies(cookie("cookieNameResponse", "cookieValueResponse")) .withHeaders( header(SET_COOKIE.toString(), "cookieNameResponse=cookieValueResponse")
.withBody("some_body_response") .withHeaders(header("headerNameResponse", "headerValueResponse")) .withCookies(cookie("cookieNameResponse", "cookieValueResponse")) ); .withReasonPhrase(HttpStatusCode.ACCEPTED_202.reasonPhrase()) .withBody("some_body_response") .withCookies(cookie("cookieNameResponse", "cookieValueResponse")) .withHeaders( header("headerNameResponse", "headerValueResponse"), .withReasonPhrase(HttpStatusCode.ACCEPTED_202.reasonPhrase()) .withBody("some_body_response") .withCookies(cookie("cookieNameResponse", "cookieValueResponse")) .withHeaders( header("headerNameResponse", "headerValueResponse"),
.withReasonPhrase(HttpStatusCode.ACCEPTED_202.reasonPhrase()) .withBody("some_body_response") .withCookies( cookie("responseCookieNameOne", "responseCookieValueOne"), cookie("responseCookieNameTwo", "responseCookieValueTwo") .withReasonPhrase(HttpStatusCode.ACCEPTED_202.reasonPhrase()) .withBody("some_body_response") .withCookies( cookie("responseCookieNameOne", "responseCookieValueOne"), cookie("responseCookieNameTwo", "responseCookieValueTwo") .withReasonPhrase(HttpStatusCode.ACCEPTED_202.reasonPhrase()) .withBody("some_body_response") .withCookies( cookie("responseCookieNameOne", "responseCookieValueOne"), cookie("responseCookieNameTwo", "responseCookieValueTwo") .withReasonPhrase(HttpStatusCode.ACCEPTED_202.reasonPhrase()) .withBody("some_body_response") .withCookies( cookie("responseCookieNameOne", "responseCookieValueOne"), cookie("responseCookieNameTwo", "responseCookieValueTwo") .withReasonPhrase(HttpStatusCode.ACCEPTED_202.reasonPhrase()) .withBody("some_body_response") .withCookies( cookie("responseCookieNameOne", "responseCookieValueOne"), cookie("responseCookieNameTwo", "responseCookieValueTwo")
.withBody("some_body_response") .withHeaders(header("headerNameResponse", "headerValueResponse")) .withCookies(cookie("cookieNameResponse", "cookieValueResponse")) ); .withReasonPhrase(HttpStatusCode.ACCEPTED_202.reasonPhrase()) .withBody("some_body_response") .withCookies(cookie("cookieNameResponse", "cookieValueResponse")) .withHeaders( header("headerNameResponse", "headerValueResponse"), .withReasonPhrase(HttpStatusCode.ACCEPTED_202.reasonPhrase()) .withBody("some_body_response") .withCookies(cookie("cookieNameResponse", "cookieValueResponse")) .withHeaders( header("headerNameResponse", "headerValueResponse"), .withReasonPhrase(HttpStatusCode.ACCEPTED_202.reasonPhrase()) .withBody("some_body_response") .withCookies(cookie("cookieNameResponse", "cookieValueResponse")) .withHeaders( header("headerNameResponse", "headerValueResponse"),
.withBody("some_body_response") .withHeaders(header("headerNameResponse", "headerValueResponse")) .withCookies(cookie("cookieNameResponse", "cookieValueResponse")) ); .withReasonPhrase(HttpStatusCode.ACCEPTED_202.reasonPhrase()) .withBody("some_body_response") .withCookies(cookie("cookieNameResponse", "cookieValueResponse")) .withHeaders( header("headerNameResponse", "headerValueResponse"), .withReasonPhrase(HttpStatusCode.ACCEPTED_202.reasonPhrase()) .withBody("some_body_response") .withCookies(cookie("cookieNameResponse", "cookieValueResponse")) .withHeaders( header("headerNameResponse", "headerValueResponse"), .withReasonPhrase(HttpStatusCode.ACCEPTED_202.reasonPhrase()) .withBody("some_body_response") .withCookies(cookie("cookieNameResponse", "cookieValueResponse")) .withHeaders( header("headerNameResponse", "headerValueResponse"),
.withBody("some_body_response") .withHeaders(header("headerNameResponse", "headerValueResponse")) .withCookies(cookie("cookieNameResponse", "cookieValueResponse")) );
.withBody("some_body_response") .withHeaders(header("headerNameResponse", "headerValueResponse")) .withCookies(cookie("cookieNameResponse", "cookieValueResponse")) );
.withBody("some_body_response") .withHeaders(header("headerNameResponse", "headerValueResponse")) .withCookies(cookie("cookieNameResponse", "cookieValueResponse")) );
.withBody("some_body_response") .withHeaders(header("headerNameResponse", "headerValueResponse")) .withCookies(cookie("cookieNameResponse", "cookieValueResponse")) );
.withBody("some_body") .withHeaders(header("headerName", "headerValue")) .withCookies(cookie("cookieName", "cookieValue")) );
.withBody("some_body") .withHeaders(header("headerName", "headerValue")) .withCookies(cookie("cookieName", "cookieValue")) );
.withBody("some_body") .withHeaders(header("headerName", "headerValue")) .withCookies(cookie("cookieName", "cookieValue")) );
.withBody("some_body") .withHeaders(header("headerName", "headerValue")) .withCookies(cookie("cookieName", "cookieValue")) );
.withBody("some_body") .withHeaders(header("headerName", "headerValue")) .withCookies(cookie("cookieName", "cookieValue")) );
.withBody("some_body") .withHeaders(header("headerName", "headerValue")) .withCookies(cookie("cookieName", "cookieValue")) );
public HttpResponse clone() { return response() .withStatusCode(statusCode) .withReasonPhrase(reasonPhrase) .withBody(body) .withHeaders(headers.clone()) .withCookies(cookies.clone()) .withDelay(getDelay()) .withConnectionOptions(connectionOptions); } }