Pastebin

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<html>
<head>
  <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
  <script>
    $(function() {
      $('#get-button').click(function() {
        var url = $('#url').val();
        var method = $('#method').val();
        var data = $('#data').val();
        var token = $('#auth-token').val();
        var opts = {
          url: url,
          method: method,
          //xhrFields: {withCredentials: true},
          headers: {'Authorization': 'Bearer ' + token}
        }
        if (data) { opts['data'] = data; }
        $.ajax(opts).done(function(data) {
          console.log('Done');
          console.log(data);
          $('#result').text('').text(JSON.stringify(data, null, 2));
        }).fail(function(data) {
          console.log('Fail');
          console.log(data);
          $('#result').text('').text(JSON.stringify(data, null, 2));
        });
      });
    });
  </script>
</head>
<body>
  OAuth Bearer Token: <input id="auth-token" type="text"><br>
  Method: <input id="method" type="text" value="GET"><br>
  URL: <input id="url" type="text" value="http://localhost:8080/rest/p/test" style="width:500px;"></br>
  Data: <input id="data" type="text"><br>
  <button id="get-button">Send</button>
  <pre id="result"></pre>
</body>
</html>