Skip to content

Commit

Permalink
bytes mostrar al obtener un error y espacio antes del estado http
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian4j committed May 28, 2022
1 parent 7d4112d commit 2ec0bc9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.sebastian4j</groupId>
<artifactId>spaceship</artifactId>
<version>1.2.0</version>
<version>1.2.1</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ protected Void call() {
textFlowPaneResponse.setText(
rb.getString("milis") + ": " + res +
" bytes: " + result.bytes() +
" status:" + result.statusCode());
" status: " + result.statusCode());
VBox vb = new VBox();
containerHeaderResponse.getChildren().clear();
result.headers().forEach((a, b) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public void kill() {

public RequestResponse sendRequest(final String url, Map<String, String> headers, boolean withBody, final String body) {
String result = "";
int status = -1;
final var sb = new StringBuilder();
final var bytes = new AtomicLong();
String[] statusCode = new String[1];
Expand Down Expand Up @@ -66,7 +65,9 @@ public RequestResponse sendRequest(final String url, Map<String, String> headers
hr.putAll(con.getHeaderFields());
} catch (Exception e) {
sb.delete(0, sb.length());
sb.append(readError());
String error = readError();
sb.append(error);
bytes.set(error.getBytes(StandardCharsets.UTF_8).length);
LOGGER.log(System.Logger.Level.ERROR, "error al obtener input stream", e);
}
});
Expand Down

0 comments on commit 2ec0bc9

Please sign in to comment.