def guess_content_type_from_body(body):
    """Guess the content-type based of the body.

    * "text/html" for str bodies starting with ``<!DOCTYPE html>`` or ``<html>``.
    * "text/plain" for other str bodies.
    * "application/json" for dict bodies.
    * "application/octet-stream" otherwise.
    """
    if isinstance(body, str):
        if body.startswith(("<!DOCTYPE html>", "<!doctype html>", "<html>")):
            return "text/html"
        else:
            return "text/plain"
    elif isinstance(body, dict):
        return "application/json"
    else:
        return "application/octet-stream"