public class Request {
public final Map<Object, Object> env;
public final Map<Object, Object> resp = new HashMap<>();
+ public String status = "200 OK";
+ public Object body = null;
public Request(Map<Object, Object> env) {
this.env = env;
}
@SuppressWarnings("unchecked")
- public void ohead(String name, Object val, boolean repl) {
+ public Request ohead(String name, Object val, boolean repl) {
name = "http." + name;
if(repl) {
resp.put(name, val);
else
resp.put(name, new ArrayList<Object>(Arrays.asList(cur, val)));
}
+ return(this);
}
+ public Request status(String status) {this.status = status; return(this);}
+ public Request body(Object body) {this.body = body; return(this);}
+
public Map<Object, Object> response() {
+ resp.put("http.status", status);
+ resp.put("jagi.output", body);
return(resp);
}
}