added content-length checks (and relevant tests);
added pre-set stream encoding checks (and relevant tests);