title: Okhttp check file size without dowloading the file
body: <p>The common examples for okhttp cover the scenarios of get and post.</p>
  
  <p>But I need to get the file size of a file with a url. Since I need to inform the the user, and only after getting their approval to download the file. </p>
  
  <p>Currently I am using this code</p>
  
  <pre><code>URL url = new URL("http://server.com/file.mp3");
  URLConnection urlConnection = url.openConnection();
  urlConnection.connect();
  int file_size = urlConnection.getContentLength();
  </code></pre>
  
  <p>mentioned in this stackoverflow question <a href="https://stackoverflow.com/questions/2983073/how-to-know-the-size-of-a-file-before-downloading-it">How to know the size of a file before downloading it?</a> </p>
  
  <p>Which works but as I am using okhttp in my project for other get requests I was hoping to use it for this scenario also.</p>