Merge pull request 'diverses' (#12) from samu_masken into master

Reviewed-on: #12
This commit is contained in:
Samuel Wolff 2024-01-11 12:09:28 +01:00
commit 0a8d4e47ac
2 changed files with 4 additions and 11 deletions

View File

@ -7,6 +7,7 @@
<option value="$PROJECT_DIR$/pom.xml" /> <option value="$PROJECT_DIR$/pom.xml" />
</list> </list>
</option> </option>
<option name="workspaceImportForciblyTurnedOn" value="true" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />

View File

@ -32,11 +32,7 @@ public class RestApiClient implements IRestAPI{
RestApiClient client1 = new RestApiClient(); RestApiClient client1 = new RestApiClient();
ElternAccount elternAccount = new ElternAccount("hiiiiiiii", "124", "pimmel@pimmel.com"); client1.post("Gericht", "{\"name\" : \"Svens Beine\", \"69.69\", \"beschreibung\" : \"Muss net schmegge, muss wirge\"}");
String json = client1.gson.toJson(elternAccount);
client1.put("Benutzer",6, json);
} }
@ -87,13 +83,9 @@ public class RestApiClient implements IRestAPI{
// Send the request and get the response // Send the request and get the response
HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString()); HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString());
Kind[] test = gson.fromJson(httpResponse.body(), Kind[].class);
// Print the response status code and body // Print the response status code and body
System.out.println("Status Code: " + httpResponse.statusCode()); System.out.println("Status Code: " + httpResponse.statusCode() + httpResponse.body());
for(Kind i : test){
System.out.println(i.getVorname());
}
//System.out.println("Response Body: " + test); //System.out.println("Response Body: " + test);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();