Added POST and GET handling according to enum. Refactoring.