Skip to content
Open
Show file tree
Hide file tree
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 @@ -21,4 +21,13 @@ public static Response buildOkResponseWithOriginHeaders(Object entity) {
.entity(entity)
.build();
}
public static Response buildBadRequestResponseWithOriginHeaders(Object entity) {
return Response
.status(Response.Status.BAD_REQUEST)
.header(ACCESS_CONTROL_ALLOW_ORIGIN, "*")
.header(ACCESS_CONTROL_ALLOW_HEADERS, "*")
.header(ACCESS_CONTROL_ALLOW_METHODS, "*")
.entity(entity)
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ public Response describeTotalActivities() {
@ApiResponses(@ApiResponse(code = HttpServletResponse.SC_OK, message = "successful operation",
response = PublicTopData.class))
public final Response searchProjects(ReportFormParameters formParams) {
ApiErrorResponse result = ReportsUtil.validateReportConfig(formParams, true);
if (result != null) {
return Response.ok(result).build(); // FIXME return bad request
ApiErrorResponse errorResponse = ReportsUtil.validateReportConfig(formParams, true);
if (errorResponse != null) {
return PublicServices.buildBadRequestResponseWithOriginHeaders(errorResponse);
}
// we need reportId only to store the report result in cache
Long reportId = (long) formParams.getReportName().hashCode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,9 @@ public final String getReportResult(
@ApiResponses(@ApiResponse(code = HttpServletResponse.SC_OK, message = "successful operation",
response = PagedReportResult.class))
public final Response getCustomReport(ReportFormParameters formParams) {
ApiErrorResponse result = ReportsUtil.validateReportConfig(formParams, true);
if (result != null) {
return Response.ok(result).build(); // FIXME return bad request
ApiErrorResponse errorResponse = ReportsUtil.validateReportConfig(formParams, true);
if (errorResponse != null) {
return PublicServices.buildBadRequestResponseWithOriginHeaders(errorResponse);
}
// we need reportId only to store the report result in cache
Long reportId = (long) formParams.getReportName().hashCode();
Expand Down