update to current version
all initial features implemented tbd: etrack front
This commit is contained in:
@@ -3,94 +3,63 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
<script type='text/javascript'>
|
||||
|
||||
|
||||
function httpGetAsync()
|
||||
{
|
||||
var clientUUID = document.getElementById("clientUUID").value;
|
||||
var mockedResponseId = document.getElementById("mockedResponseId").value;
|
||||
var url = "http://localhost:8097/klaus/v1/get/" + clientUUID + "/" + mockedResponseId;
|
||||
var xmlHttp = new XMLHttpRequest();
|
||||
xmlHttp.onreadystatechange = function() {
|
||||
if (xmlHttp.readyState == 4 && xmlHttp.status == 200)
|
||||
alert(xmlHttp.responseText);
|
||||
}
|
||||
xmlHttp.open("GET", url, true);
|
||||
xmlHttp.send(null);
|
||||
var container = document.getElementById("getMockedResponse");
|
||||
container.appendChild(document.createElement("br"));
|
||||
container.appendChild(document.createTextNode(xmlHttp.responseText));
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
</script>
|
||||
<script src="/js/main.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<br>----------------------------------------------------------------------------------------------------------------
|
||||
<hr>
|
||||
<div><br>In order to set mockup response. Please send the response, that you want to receive, on:
|
||||
<br>http://localhost:8097/klaus/v1/set/ <a th:text="${mockedResponseDto.clientUUID}">clientUUID should be here</a>/{mockedResponseId}?httpStatus=200
|
||||
<br>or simply fill and submit the below form:</div>
|
||||
|
||||
<div class="col-lg-4 form-max">
|
||||
sayHi('John');
|
||||
<form action="#" th:action="@{/home}" th:object="${mockedResponseDto}" method="post">
|
||||
<input type="text" th:field="*{clientUUID}" th:placeholder="*{clientUUID}" hidden/>
|
||||
<br><label >Mocked response id:</label><br/>
|
||||
<input type="text" th:field="*{mockedResponseId}" th:value=1/>
|
||||
<br><label >Mocked response body:</label><br/>
|
||||
<textarea rows="4" cols="50" th:field="*{messageBody}" th:placeholder='messageBody'></textarea>
|
||||
<br><label >Mocked response http code status:</label><br/>
|
||||
<input type="text" th:name="httpStatus" th:value='200' />
|
||||
<br>Provide mocked response headers: <a href="#" id="addHeader" onclick="addFields()">Add a new header</a>
|
||||
<div id="headers"></div>
|
||||
<br><label >Media type:</label>
|
||||
<select th:field="*{mediaType}">
|
||||
<option value="application/xml">application/xml</option>
|
||||
<option value="application/json">application/json</option>
|
||||
<option value="text/xml">text/xml</option>
|
||||
</select>
|
||||
<input type="submit" value="Save mocked response" onclick="submit()"/>
|
||||
<table>
|
||||
<input type="text" th:field="*{clientUUID}" th:placeholder="*{clientUUID}" hidden/>
|
||||
<tr>
|
||||
<td>Mocked response id:</td>
|
||||
<td><input type="text" th:field="*{mockedResponseId}" th:value=1/></td>
|
||||
<td th:if="${#fields.hasErrors('mockedResponseId')}" th:errors="*{mockedResponseId}">Id Error</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Mocked response body:</td>
|
||||
<td><textarea rows="4" cols="50" th:field="*{messageBody}" th:placeholder='messageBody'></textarea></td>
|
||||
<td th:if="${#fields.hasErrors('messageBody')}" th:errors="*{messageBody}">Body Error</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Mocked response http code status:</td>
|
||||
<td><input type="text" th:field="*{httpStatus}" th:value='200'></td>
|
||||
<td th:if="${#fields.hasErrors('httpStatus')}" th:errors="*{httpStatus}">HttpStatus Error</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Provide mocked response headers:</td>
|
||||
<td><a href="#" id="addHeader" onclick="addFields()">Add a new header</a>
|
||||
<table>
|
||||
<tr>
|
||||
<td><div id="headers"></div></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Media type:</td>
|
||||
<td><select th:field="*{mediaType}">
|
||||
<option value="application/xml">application/xml</option>
|
||||
<option value="application/json">application/json</option>
|
||||
<option value="text/xml">text/xml</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type="submit" value="Save mocked response"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<p th:if="${mockSaved}">Mock has been saved</p>
|
||||
|
||||
|
||||
<br>----------------------------------------------------------------------------------------------------------------
|
||||
<hr>
|
||||
|
||||
<div><br>In order to use the mocked response in your integration tests or simply
|
||||
get your mocked response please send a request to
|
||||
<br>http://localhost:8097/klaus/v1/get/<a th:text="${mockedResponseDto.clientUUID}">clientUUID should be here</a>/{mockedResponseId}
|
||||
@@ -104,7 +73,7 @@ function httpGet()
|
||||
<input type="text" th:field="*{mockedResponseId}" th:placeholder="12345"/>
|
||||
<input type="submit" value="Get mocked response"/>
|
||||
</form>
|
||||
<br>----------------------------------------------------------------------------------------------------------------
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user