Skip to content

Commit bb1ca35

Browse files
committed
Refactor handling queryString in RequestLogger
1 parent 9dfd962 commit bb1ca35

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

jooby/src/main/java/org/jooby/RequestLogger.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,8 @@ public void handle(final Request req, final Response rsp) throws Throwable {
250250
sb.append(Q).append(req.method());
251251
sb.append(SP);
252252
sb.append(req.path());
253-
if (queryString && req.queryString().isPresent()) {
254-
sb.append(QUERY);
255-
sb.append(req.queryString().get());
253+
if (queryString) {
254+
req.queryString().ifPresent(s -> sb.append(QUERY).append(s));
256255
}
257256
sb.append(SP);
258257
sb.append(req.protocol());

jooby/src/test/java/org/jooby/RequestLoggerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ private Block path(final String path) {
172172
private Block query(final String query) {
173173
return unit -> {
174174
Request req = unit.get(Request.class);
175-
expect(req.queryString()).andReturn(Optional.of(query)).atLeastOnce();
175+
expect(req.queryString()).andReturn(Optional.of(query));
176176
};
177177
}
178178

0 commit comments

Comments
 (0)