docs/console.js
function makeRequest(){
  output('Sending the request...');
  var options = {
    method: $method.value,
    headers: {
      Accept: document.getElementById('accept').value
    },
    followRedirect: $followRedirect.checked
  };
  if(options.method === 'POST'){
    options.body = $requestBody.value;
  }
  client.request($url.value, options, function(error, response){
    if(error){
      genericError();
    } else {
      displayResponse(response);
      
      if(response.statusCode === 401){
        $authStatus.classList.remove('loggedin');
        $tokenDisplay.value = '';
        
      } else {
        $authStatus.classList.add('loggedin');
        $tokenDisplay.value = 'Bearer ' + client.getAccessToken();
      }
    }
  });
}
function makeRequest(){
  output('Sending the request...');
  var options = {
    method: $method.value,
    headers: {
      Accept: document.getElementById('accept').value
    },
    followRedirect: $followRedirect.checked
  };
  if(options.method === 'POST'){
    options.body = $requestBody.value;
  }
  client.request($url.value, options, function(error, response){
    if(error){
      genericError();
    } else {
      displayResponse(response);
      
      if(response.statusCode === 401){
        $authStatus.classList.remove('loggedin');
        $tokenDisplay.value = '';
        
      } else {
        $authStatus.classList.add('loggedin');
        $tokenDisplay.value = 'Bearer ' + client.getAccessToken();
      }
    }
  });
}
function makeRequest ( ) { output ( 'Sending the request...' ) ; var options = { method : $method . value , headers : { Accept : document . getElementById ( 'accept' ) . value } , followRedirect : $followRedirect . checked } ; if ( options . method === 'POST' ) { options . body = $requestBody . value ; } client . request ( $url . value , options , function ( error , response ) { if ( error ) { genericError ( ) ; } else { displayResponse ( response ) ; if ( response . statusCode === 401 ) { $authStatus . classList . remove ( 'loggedin' ) ; $tokenDisplay . value = '' ; } else { $authStatus . classList . add ( 'loggedin' ) ; $tokenDisplay . value = 'Bearer ' + client . getAccessToken ( ) ; } } } ) ; }
Send a request to the API and display the response
Send a request to the API and display the response