spec for #encode: to ensure it works with headers as Hash as well