Fixes to GZip middleware

- Method checking move to the head event
- Rename of names to keys
- Missing keys declaration
- Logic improvement if/else if