simplified code for checking the HTTP method