FIX: Reading response header instead of hacking to get json type