Fix ClassCastException during handling of HTTP