Compatibility with Haxe 3.1.1 (or later)

I found a compile error after I upgraded Haxe to 3.1.2. They changed params and headers from Map into List in Haxe 3.1.1 (https://github.com/HaxeFoundation/haxe/commit/fcde6b7994a619f93f7d1e626827b1900f0391de#diff-0). So I fixed it.

I've added support for Haxe 2 as well... the only problem for now is it's not support the Haxe version >= 3.0.0 && version < 3.1.1.