Added support for both json and form encoded payloads