vertx.effect.httpclient.HttpResp Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vertx-effect Show documentation
Show all versions of vertx-effect Show documentation
When actors meet Functional Programming
package vertx.effect.httpclient;
import jsonvalues.*;
import java.util.function.Function;
public class HttpResp extends JsObj{
private static final String STATUS_CODE_FIELD = "status_code";
private static final String STATUS_MESSAGE_FIELD = "status_message";
private static final String COOKIES_FIELD = "cookies";
private static final String HEADERS_FIELD = "headers";
private static final String BODY_FIELD = "body";
public static final Lens STATUS_CODE_LENS =
JsObj.lens.intNum(STATUS_CODE_FIELD);
public static final Option STATUS_MESSAGE_OPT =
JsObj.optional.str(STATUS_MESSAGE_FIELD);
public static final Lens COOKIES_LENS =
JsObj.lens.array(COOKIES_FIELD);
public static final Lens HEADERS_OPT =
JsObj.lens.obj(HEADERS_FIELD);
public static final Lens STR_BODY_LENS =
JsObj.lens.str(BODY_FIELD);
public static final Function, Function> mapBody =
fn -> resp -> resp.set(BODY_FIELD,
fn.apply(resp.getStr(BODY_FIELD))
);
public static final Function mapBody2Json = mapBody.apply(JsObj::parse);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy