37 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| function httpGet()
 | |
| {
 | |
|   var clientUUID = document.getElementById("getClientUUID").value;
 | |
|    var mockedResponseId = document.getElementById("getMockedResponseId").value;
 | |
|    var url = "http://localhost:8097/klaus/v1/get/" + clientUUID + "/" + mockedResponseId;
 | |
|     var xmlHttp = new XMLHttpRequest();
 | |
|     xmlHttp.open( "GET", url, false ); // false for synchronous request
 | |
|     xmlHttp.send( null );
 | |
| 
 | |
|     var container = document.getElementById("getMockedResponse");
 | |
|     var headers = xmlHttp.getAllResponseHeaders();
 | |
|     container.appendChild(document.createTextNode(headers));
 | |
|     container.appendChild(document.createTextNode("Your message: "));
 | |
|     container.appendChild(document.createElement("br"));
 | |
|     container.appendChild(document.createTextNode((xmlHttp.responseText)));
 | |
|     return xmlHttp.responseText;
 | |
| 
 | |
| }
 | |
| 
 | |
|         var numberOfHeaders = 0;
 | |
|             function addFields(){
 | |
|             var container = document.getElementById("headers");
 | |
| 
 | |
|                 numberOfHeaders++;
 | |
|                 container.appendChild(document.createElement("br"));
 | |
|                 container.appendChild(document.createTextNode("Header " + (numberOfHeaders)));
 | |
|                 var headerInput = document.createElement("input");
 | |
|                 headerInput.type = "text";
 | |
|                 headerInput.name = "header";
 | |
|                 container.appendChild(headerInput);
 | |
| 
 | |
|                 container.appendChild(document.createTextNode("Value " + (numberOfHeaders)));
 | |
|                 var valueInput = document.createElement("input");
 | |
|                 valueInput.type = "text";
 | |
|                 valueInput.name = "value";
 | |
|                 container.appendChild(valueInput);
 | |
|         } | 
