APISonar


act.test.RequestSpec.json

> act > test > RequestSpec > json
act APIs test APIs RequestSpec APIs json APIs

Example 1
private void addAjax() {
        Keyword key = Keyword.of("ajax");
        if (store.containsKey(key)) {
            return;
        }
        RequestSpec spec = new RequestSpec();
        spec.ajax = true;
        spec.json = true;
        store.put(key, spec);
    }
Example 2
public void test() {
        RequestTemplateManager manager = new RequestTemplateManager();
        manager.load();
        RequestSpec spec = manager.getTemplate("global");
        notNull(spec);
        eq("last|", spec.headers.get("Authorization"));
        isNull(spec.ajax);
        isNull(spec.json);
        spec = manager.getTemplate("ajax");
        notNull(spec);
        eq("last|", spec.headers.get("Authorization"));
        yes(spec.ajax);
        eq("json", spec.accept);
    }