title: Axios Proxy Configuration causing Bad Request
body: <p>I am trying to send a request to the particle cloud from a NodeJS application.
  I am using Axios to make the PUT request. The application sends the request through a proxy server which is configured as well.</p>
  
  <pre><code>// axios proxy - not working
  axios.default.put("https://api.particle.io/v1/devices/&lt;deviceId&gt;/ping", {}, {
  proxy: {host: &lt;proxy_ip&gt;, protocol:'http', port:&lt;port_no&gt;},
  headers: {
      authorization: "Bearer &lt;access_token&gt;"
  }
  }).then((response) =&gt; {
      console.log("Success", response.data);
  }).catch((error) =&gt; {
     console.log("Failed", error);
  });
  </code></pre>
  
  <blockquote>
    <p>Error Message: Request failed with status code 400</p>
  </blockquote>
  
  <p>When I send this request I get a 400 Bad Request response from the particle cloud.
  But when I send the same request using the request module of NodeJS, the request is successful.</p>
  
  <pre><code>var options = {
     method: 'PUT',
     url: 'https://api.particle.io/v1/devices/&lt;device_id&gt;/ping',
     proxy: {hostname: &lt;proxy_ip&gt;, protocol:'http', port:&lt;port_no&gt;},
     headers: 
     { 
         authorization: 'Bearer &lt;access_token&gt;'
     },
     form: false
  };
  request(options, function (error, response, body) {
     if (error) throw new Error(error);
     console.log(response);
  });
  </code></pre>
  
  <blockquote>
    <p>Response: body: '{"online":false,"ok":true}'</p>
  </blockquote>
  
  <p>The request also works when the application was deployed on the open network and axios was used without the proxy configuration.</p>
  
  <pre><code>// axios without proxy - working
  axios.default.put("https://api.particle.io/v1/devices/&lt;deviceId&gt;/ping", {}, {
      headers: {
          authorization: "Bearer &lt;access_token&gt;"
      }
  }).then((response) =&gt; {
      console.log("Success", response.data);
  }).catch((error) =&gt; {
      console.log("Failed", error);
  });
  </code></pre>
  
  <p>Questions:</p>
  
  <ol>
  <li>Why is the request from Axios failing with proxy configuration?</li>
  <li>Is this an inherent issue with Axios?</li>
  </ol>
  
  <p>Regards.</p>