Add code to switch between sending post data in the body (as JSON) or in the POST