Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

Commit

Permalink
Allow the webservlet to have a query parameter (for feedback on bug r…
Browse files Browse the repository at this point in the history
…eports)
  • Loading branch information
nielsbasjes committed Feb 22, 2021
1 parent 5e10d4a commit bd4c1e3
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.WebRequest;
Expand Down Expand Up @@ -352,8 +353,13 @@ private static class MissingUserAgentException extends RuntimeException {
value = "/",
produces = MediaType.TEXT_HTML_VALUE
)
public String getHtml(@RequestHeader("User-Agent") String userAgentString) {
return doHTML(userAgentString);
public String getHtml(@RequestHeader("User-Agent") String userAgentString,
@RequestParam(name = "ua", required = false) String userAgentStringParam) {
if (userAgentStringParam == null || userAgentStringParam.isEmpty()) {
return doHTML(userAgentString);
} else {
return doHTML(userAgentStringParam);
}
}

@PostMapping(
Expand Down

0 comments on commit bd4c1e3

Please sign in to comment.