Http utils extracted from https://github.com/99designs/ergo