Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added request URI to application runtime error event, enhancing error logging and debugging capabilities. #335

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public class HttpRequest {

@JsonIgnore
public static final int MAX_ALLOWED_REQUEST_BODY_LENGTH = 500000;
@JsonIgnore
public static final String QUESTION_MARK = "?";

private StringBuilder body;

Expand Down Expand Up @@ -40,6 +42,7 @@ public class HttpRequest {
private boolean isGrpc;

private String route;
private String requestURI;

private Map<String, String> customDataType;

Expand Down Expand Up @@ -73,6 +76,7 @@ public HttpRequest() {
this.isRequestParsed = false;
this.isGrpc = false;
this.route = StringUtils.EMPTY;
this.requestURI = StringUtils.EMPTY;
this.customDataType = new HashMap<>();
}

Expand All @@ -91,6 +95,7 @@ public HttpRequest(HttpRequest servletInfo) {
this.isRequestParsed = servletInfo.isRequestParsed;
this.isGrpc = servletInfo.isGrpc;
this.route = servletInfo.route;
this.requestURI = servletInfo.requestURI;
this.pathParameterMap = servletInfo.pathParameterMap;
this.queryParameters = servletInfo.queryParameters;
this.requestHeaderParameters = servletInfo.requestHeaderParameters;
Expand All @@ -113,6 +118,7 @@ public String getUrl() {

public void setUrl(String url) {
this.url = url;
this.requestURI = StringUtils.substringBefore(url, QUESTION_MARK);
}

public Map<String, String> getHeaders() {
Expand Down Expand Up @@ -249,6 +255,14 @@ public void setRoute(String route){
this.route = StringUtils.removeEnd(StringUtils.prependIfMissing(route, StringUtils.SEPARATOR), StringUtils.SEPARATOR);
}

public String getRequestURI() {
return requestURI;
}

public void setRequestURI(String requestURI) {
this.requestURI = requestURI;
}

public void setRoute(String segment, boolean isAlreadyServlet) {
// remove servlet detected route if another framework detected;
if (isAlreadyServlet) {
Expand Down
Loading