adding validate_allowed_methods to API and unit tests