Fixed issue where DashboardState was saved with partial details

This commit is contained in:
Rohit Awate 2018-02-15 14:19:31 +05:30
parent aab5c2d8f8
commit 921654200d
2 changed files with 20 additions and 19 deletions

View file

@ -16,7 +16,7 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>2.4</version> <version>3.1.0</version>
<executions> <executions>
<!-- Run shade goal on package phase --> <!-- Run shade goal on package phase -->
<execution> <execution>

View file

@ -395,25 +395,26 @@ public class DashboardController implements Initializable {
*/ */
public DashboardState getState() { public DashboardState getState() {
DashboardState dashboardState = null; DashboardState dashboardState = null;
try { switch (httpMethodBox.getValue()) {
switch (httpMethodBox.getValue()) { case "POST":
case "POST": case "PUT":
case "PUT": dashboardState = new DashboardState(bodyTabController.getBasicRequest(httpMethodBox.getValue()));
dashboardState = new DashboardState(bodyTabController.getBasicRequest(httpMethodBox.getValue())); dashboardState.setHeaders(headerTabController.getHeaders());
dashboardState.setHeaders(headerTabController.getHeaders()); break;
break; default:
default: // For GET, DELETE requests
// For GET, DELETE requests dashboardState = new DashboardState();
dashboardState = new DashboardState();
}
dashboardState.setTarget(addressField.getText());
dashboardState.setHttpMethod(httpMethodBox.getValue());
dashboardState.setHeaders(headerTabController.getHeaders());
dashboardState.setParams(getParams());
} catch (MalformedURLException MURLE) {
System.out.println("Dashboard state was saved with a malformed URL.");
} }
try {
dashboardState.setTarget(addressField.getText());
} catch (MalformedURLException e) {
System.out.println("Dashboard state was saved with an invalid URL.");
}
dashboardState.setHttpMethod(httpMethodBox.getValue());
dashboardState.setHeaders(headerTabController.getHeaders());
dashboardState.setParams(getParams());
return dashboardState; return dashboardState;
} }