Skip to content

Add queryString: Optional<String> method to Request and NativeRequest #518

@jknack

Description

@jknack

The way to get the queryString today is a bit awkward:

get("/514", req -> {
      Map<String, Mutant> params = req.params().toMap();
      return req.path() + "?" + params.entrySet().stream()
          .map(e -> e.getKey() + "=" + e.getValue().value()).collect(Collectors.joining("&"));
    });

On next release this will provided via Request.queryString method

get("/514", req -> {
      return req.path() + req.queryString().map(q -> "?" + q).orElse("");
    });

See #514

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions