Added support for setting HTTP method and made onSuccess callback more generic.