DRYing up a bunch in http handlers and server test