title: How to add OPTIONS request before main request in axios
body: <p><strong>I want to send OPTIONS request before main request for solve CORS problem.</strong>
  How to solve this problem from client side?</p>
  
  <p>I used a browser extension for solve problem. And it worked. But I don't want to use an extension</p>
  
  <p><a href="https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi/related" rel="nofollow noreferrer">https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi/related</a></p>
  
  <p>And here's my code:</p>
  
  <pre><code>import axios from 'axios'
  
  const service = axios.create({
      baseURL: "http://sub.domain.com/api/",
      timeout: 10000,
      headers: {
          'Content-Type': 'application/json',
          'Accept': 'application/json',
          'Authorization': 'auth'
      }
  })
  
  
  export default class API {
      static getData () {
          return service.get('get-data')
      }
  }
  
  =====
  
  API.getData()
  
  </code></pre>