httptest was adding an extra flag, which was sort of ugly. Instead, reimplement the parts of its functionality we were using. Bonus: due to specialization, it's now a bit more efficient as well!