made URLs relative so host does not require absolute URL, and moved POST checking into request