T157 put request is send. 415 response format unaccepted
This commit is contained in:
		
							
								
								
									
										8
									
								
								.idea/workspace.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										8
									
								
								.idea/workspace.xml
									
									
									
										generated
									
									
									
								
							| @@ -20,13 +20,11 @@ | ||||
|   </component> | ||||
|   <component name="ChangeListManager"> | ||||
|     <list default="true" id="458cde88-df3d-44bc-9d57-a33823e2f1a6" name="Default Changelist" comment=""> | ||||
|       <change afterPath="$PROJECT_DIR$/src/main/resources/static/js/jquery.js" afterDir="false" /> | ||||
|       <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> | ||||
|       <change beforePath="$PROJECT_DIR$/src/main/java/com/release11/klaus/controller/MockController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/release11/klaus/controller/MockController.java" afterDir="false" /> | ||||
|       <change beforePath="$PROJECT_DIR$/src/main/resources/static/js/datatransfer.js" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/static/js/datatransfer.js" afterDir="false" /> | ||||
|       <change beforePath="$PROJECT_DIR$/src/test/java/com/release11/klaus/KlausApplicationTests.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/com/release11/klaus/KlausApplicationTests.java" afterDir="false" /> | ||||
|       <change beforePath="$PROJECT_DIR$/src/test/java/com/release11/klaus/config/RedisConfigTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/com/release11/klaus/config/RedisConfigTest.java" afterDir="false" /> | ||||
|       <change beforePath="$PROJECT_DIR$/src/test/java/com/release11/klaus/controller/KlausControllerTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/com/release11/klaus/controller/KlausControllerTest.java" afterDir="false" /> | ||||
|       <change beforePath="$PROJECT_DIR$/src/test/java/com/release11/klaus/repository/EventRepositoryImplTest.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/test/java/com/release11/klaus/repository/EventRepositoryImplTest.java" afterDir="false" /> | ||||
|       <change beforePath="$PROJECT_DIR$/src/main/resources/templates/mock.html" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/templates/mock.html" afterDir="false" /> | ||||
|     </list> | ||||
|     <option name="SHOW_DIALOG" value="false" /> | ||||
|     <option name="HIGHLIGHT_CONFLICTS" value="true" /> | ||||
| @@ -315,7 +313,7 @@ | ||||
|       <workItem from="1612259068808" duration="10440000" /> | ||||
|       <workItem from="1612279535476" duration="5692000" /> | ||||
|       <workItem from="1612442837870" duration="8318000" /> | ||||
|       <workItem from="1612609113694" duration="1761000" /> | ||||
|       <workItem from="1612609113694" duration="5466000" /> | ||||
|     </task> | ||||
|     <task id="LOCAL-00077" summary="testing jenkins docker"> | ||||
|       <created>1601453886631</created> | ||||
|   | ||||
| @@ -36,7 +36,6 @@ public class MockController { | ||||
|         4. After each action cookie is updated | ||||
|         Cookie holds uuid, last displayed message | ||||
|      */ | ||||
|     //TODO: There is no bean for UUID | ||||
|     //TODO: Add cookie in javascript | ||||
|     /** | ||||
|      * Responds to first user request. If UUID is given then it's set if it's not, then new one is generated. | ||||
| @@ -49,7 +48,7 @@ public class MockController { | ||||
|         return "mock"; | ||||
|     } | ||||
|  | ||||
|     @PutMapping("/mock/{uuid}") | ||||
|     @PutMapping("/mock/json") | ||||
|     public ResponseEntity<String> updateMessage(@RequestBody MockedMessageDto message){ | ||||
|         return klausService.setMockedResponse(message); | ||||
|     } | ||||
|   | ||||
| @@ -23,6 +23,23 @@ function getData(uuid){ | ||||
|     }); | ||||
| } | ||||
|  | ||||
| function updateData(){ | ||||
|     var updatedJson = generateJson(); | ||||
|     $.ajax({ | ||||
|         url: 'http://localhost:8097/mock/json', | ||||
|         type: 'PUT', | ||||
|         data: updatedJson, | ||||
|         success: function(data) { | ||||
|             console.log('PUT request received 200'); | ||||
|         } | ||||
|     }); | ||||
|     // $.put('http://localhost:8097/mock/json', function(data){ | ||||
|     // | ||||
|     // }); | ||||
|     // console.log('PUT request sent'); | ||||
|     getData(); | ||||
| } | ||||
|  | ||||
|  | ||||
| function clearMock(){ | ||||
|     fillStaticFields('','','',''); | ||||
| @@ -143,13 +160,9 @@ function sleep(ms) { | ||||
|     return new Promise(resolve => setTimeout(resolve, ms)); | ||||
| } | ||||
|  | ||||
| function saveChanges(){ | ||||
|     convertTableToJson(); | ||||
|     generateJson(); | ||||
| } | ||||
|  | ||||
|  | ||||
| function generateJson(){ | ||||
|     console.log("Save button click"); | ||||
|     var newJson = | ||||
|         { | ||||
|             clientUUID: json[jsonIndex].clientUUID, | ||||
| @@ -160,7 +173,8 @@ function generateJson(){ | ||||
|             httpHeaders: {}, | ||||
|         }; | ||||
|     newJson['httpHeaders'] = convertTableToJson(); | ||||
|     document.write(JSON.stringify(newJson, null, 2)); | ||||
|     console.log(JSON.stringify(newJson, null, 2)); | ||||
|     return newJson; | ||||
| } | ||||
|  | ||||
| // $("table tr").eq(row).find("td").eq(i%2).append("<img src='"+dataJson[i].imagen+"' width='100'/>"); | ||||
|   | ||||
							
								
								
									
										2
									
								
								src/main/resources/static/js/jquery.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								src/main/resources/static/js/jquery.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -7,7 +7,8 @@ | ||||
|     <link rel="stylesheet" href="/Dependency/fontello-plus/css/fontello.css" type="text/css"/> | ||||
|     <link rel="preconnect" href="https://fonts.gstatic.com"> | ||||
|     <link href="https://fonts.googleapis.com/css2?family=Acme&family=Josefin+Slab:wght@500&display=swap" rel="stylesheet"> | ||||
|     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> | ||||
|     <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script> | ||||
| <!--    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>--> | ||||
|     <script type="text/javascript" src="/js/datatransfer.js"></script> | ||||
| </head> | ||||
| <body> | ||||
| @@ -75,7 +76,7 @@ | ||||
|                     <div id="history" style="display:none;"></div> | ||||
|                 </div> | ||||
|                 <div id="functionBar"> | ||||
|                     <button id="btn-save" type="submit" class="functionBarButton" onclick="saveChanges()">Save</button> | ||||
|                     <button id="btn-save" type="submit" class="functionBarButton" onclick="updateData()">Save</button> | ||||
|                     <div style="clear: both;"></div> | ||||
|                 </div> | ||||
|         </div> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user