@@ -23,13 +23,8 @@ var jsonPP = {
2323$ ( document ) . ready ( function ( ) {
2424
2525 var setResponse = function ( method , response ) {
26-
27- console . log ( response ) ;
28- console . log ( response . status ) ;
29-
3026 if ( method == 'OPTIONS' ) {
31- $ ( '#responseData' ) . html ( jsonPP . prettyPrint ( response ) ) ;
32- return ;
27+ return $ ( '#responseData' ) . html ( jsonPP . prettyPrint ( response ) ) ;
3328 }
3429
3530 // Status Code
@@ -59,9 +54,6 @@ $( document ).ready(function() {
5954
6055 $ ( '#responseStatusText' ) . text ( response . statusText . toLowerCase ( ) ) ;
6156 $ ( '#responseData' ) . html ( jsonPP . prettyPrint ( response . responseJSON ) ) ;
62-
63- // console.log(response);
64- // console.log(response.responseJSON);
6557 } ;
6658
6759 var makeRequest = function ( ) {
@@ -81,12 +73,10 @@ $( document ).ready(function() {
8173 } ) ;
8274 } ;
8375
84- var setupForm = function ( data ) {
85- $ ( '#urlInput' ) . val ( data . path ) ;
86-
76+ var _setupMethods = function ( methods ) {
8777 // List Methods (Radio Buttons)
8878 // FIXME: Use regex - convert to JSON
89- var methods = data . methods . replace ( "[" , "" ) . replace ( "]" , "" ) . replace ( / ' / g, "" ) . replace ( / \s / g, "" ) . split ( ',' ) ;
79+ var methods = methods . replace ( "[" , "" ) . replace ( "]" , "" ) . replace ( / ' / g, "" ) . replace ( / \s / g, "" ) . split ( ',' ) ;
9080 $ . each ( methods , function ( i , method ) {
9181 var methodClass = "btn btn-sm method " + method . toLowerCase ( ) ;
9282 $ ( '#methods' ) . append ( "<button type='button' class='" + methodClass + "'>" + method + "</button>" ) ;
@@ -101,6 +91,17 @@ $( document ).ready(function() {
10191 // Add 'active' to the clicked button
10292 $ ( this ) . addClass ( 'active' ) ;
10393 } ) ;
94+ } ;
95+
96+ var _setupFields = function ( fields ) {
97+
98+ } ;
99+
100+ var setupForm = function ( data ) {
101+ $ ( '#urlInput' ) . val ( data . path ) ;
102+
103+ _setupMethods ( data . methods ) ;
104+ _setupFields ( data . fields ) ;
104105
105106 $ ( '#requestForm' ) . submit ( function ( e ) {
106107 // Prevent Submit
0 commit comments