fix import of URLError and convert request body to bytes