Modified testEndpoint method in AngularJS and added helper methods to allow input when method is POST or PUT