Fix framing issue in the encode_body() method