title: Troubleshooting axios requests
body: <p>I've come across this problem a few times now and I feel like there's someone out there who knows a better way to troubleshoot api calls than i - specifically request headers. </p>
  
  <p>Often when i need to pass my api token via a request header, I am constantly groping at the exact format to pass my key's (it seems there's not a universal format for doing this). </p>
  
  <p>For example, I am currently trying to access the vultr v1 api. The docs give a curl example where <code>API-Key: SOMEKEY</code> needs to be passed, yet, my first attempt rarely works then i'm just groping... Do they want my key in a key/value pair or a single string in an array? Do i use es6 objects (without quotes) or not.</p>
  
  <p>here's what i mean:</p>
  
  <pre><code>// one method 
  const opts = {
    headers: {
      API-Key: 'SOMEKEY'
    }
  }
  // another
  const opts = {
    'headers': {
      'API-Key': 'SOMEKEY'
    }
  }
  // another
  const opts = {
    headers: [
      'API-Key: SOMEKEY'
    ]
  }
  
  axios.get(url, opts).then(res =&gt; console.log(res.data))
  </code></pre>
  
  <p>which is the proper way? In the curl example given by vultr it shows:
  <code>curl -H 'API-Key: EXAMPLE' https://api.vultr.com/v1/iso/list</code></p>
  
  <p>I also see in my network inspector that the request headers show i am passing my API key yet i am still getting a 403 (bad key error)
  <a href="https://i.stack.imgur.com/JzYQl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JzYQl.png" alt="network inspector"></a></p>
  
  <p>I have double checked the validity of my key and that's not the problem.
  My question is this:
  How do i find the correct format for the headers? Is there a better troubleshooting method for this kind of problem? Any help would be greatly appreciated. Thanks ya'll</p>
  
  <p>UPDATE: 
  Turns out they've got access control based on IP's. I hadn't noticed it till just now. They were blocking my request because of this. My question still stands however. Good methods for figuring out correct formats? Is there a correct format?</p>