Refactor HTTP request builders to be more generic and allow user-defined methods, close #1341