Fix issue where responseHeaders were lost in tab-switching
This commit is contained in:
parent
7f9c14d6f6
commit
ac0fb816f2
2 changed files with 11 additions and 7 deletions
|
@ -437,6 +437,7 @@ public class DashboardController implements Initializable {
|
|||
statusCodeDescription.setText(Response.Status.fromStatusCode(state.statusCode).getReasonPhrase());
|
||||
responseTime.setText(Long.toString(state.responseTime) + " ms");
|
||||
responseSize.setText(Integer.toString(state.responseSize) + " B");
|
||||
System.out.println(state.responseHeaders.size());
|
||||
responseHeadersViewer.populate(state.responseHeaders);
|
||||
}
|
||||
|
||||
|
@ -627,7 +628,7 @@ public class DashboardController implements Initializable {
|
|||
dashboardState.showResponse = responseLayer.isVisible();
|
||||
|
||||
if (dashboardState.showResponse) {
|
||||
dashboardState.responseHeaders = headerTabController.getHeaders();
|
||||
dashboardState.responseHeaders = responseHeadersViewer.getHeaders();
|
||||
dashboardState.statusCode = Integer.parseInt(statusCode.getText());
|
||||
|
||||
String temp = responseSize.getText();
|
||||
|
|
|
@ -23,12 +23,11 @@ import javafx.scene.control.ScrollPane;
|
|||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.VBox;
|
||||
|
||||
import javax.ws.rs.core.MultivaluedHashMap;
|
||||
import java.util.HashMap;
|
||||
|
||||
class ResponseHeadersViewer extends ScrollPane {
|
||||
private VBox container;
|
||||
private MultivaluedHashMap<String, String> map;
|
||||
private HashMap<String, String> map;
|
||||
|
||||
ResponseHeadersViewer() {
|
||||
this.container = new VBox();
|
||||
|
@ -38,18 +37,18 @@ class ResponseHeadersViewer extends ScrollPane {
|
|||
this.setFitToHeight(true);
|
||||
this.setFitToWidth(true);
|
||||
|
||||
map = new MultivaluedHashMap<>();
|
||||
map = new HashMap<>();
|
||||
}
|
||||
|
||||
void populate(HashMap<String, String> headers) {
|
||||
map.clear();
|
||||
headers.forEach((key, value) -> map.putSingle(key, value));
|
||||
headers.forEach((key, value) -> map.put(key, value));
|
||||
populate();
|
||||
}
|
||||
|
||||
void populate(EverestResponse response) {
|
||||
map.clear();
|
||||
response.getHeaders().forEach((key, value) -> map.putSingle(key, value.get(0)));
|
||||
response.getHeaders().forEach((key, value) -> map.put(key, value.get(0)));
|
||||
populate();
|
||||
}
|
||||
|
||||
|
@ -60,11 +59,15 @@ class ResponseHeadersViewer extends ScrollPane {
|
|||
Label keyLabel = new Label(key + ": ");
|
||||
keyLabel.getStyleClass().addAll("visualizerKeyLabel", "visualizerLabel");
|
||||
|
||||
Label valueLabel = new Label(value.get(0));
|
||||
Label valueLabel = new Label(value);
|
||||
valueLabel.getStyleClass().addAll("visualizerValueLabel", "visualizerLabel");
|
||||
|
||||
container.getChildren().add(new HBox(keyLabel, valueLabel));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public HashMap<String, String> getHeaders() {
|
||||
return new HashMap<>(map);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue