Factored queryHTTP and document object.