Skip to content

Commit

Permalink
add 400 bad request size
Browse files Browse the repository at this point in the history
  • Loading branch information
noemil12 committed Nov 27, 2023
1 parent 1cfe80b commit 5a80ae6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public enum ExceptionTypeEnum {
AGREEMENT_NOT_VALID("AGREEMENT_NOT_VALID", "Non si dispone delle autorizzazioni necessarie per utilizzare il sistema"),
JWT_PARSER_ERROR("JWT_PARSER_ERROR", "Non è stato possibile decodificare il voucher."),
UNAUTHORIZED("NOT_AUTHORIZED", "User not authorized"),
SIZE_NOT_VALID("SIZE_NOT_VALID", "size non può essere maggiore di 100"),
SIGNALID_ALREADY_EXISTS("SIGNALID_NOT_EXISTS", "non esiste nessun segnale per il signalId selezionato");

private final String title;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.List;

import static it.pagopa.interop.signalhub.pull.service.exception.ExceptionTypeEnum.NO_AUTH_FOUNDED;
import static it.pagopa.interop.signalhub.pull.service.exception.ExceptionTypeEnum.SIZE_NOT_VALID;


@RestController
Expand All @@ -28,7 +29,7 @@ public class SignalController implements GatewayApi {

@Override
public Mono<ResponseEntity<PaginationSignal>> getRequest(String eserviceId, Long signalId, Long size, ServerWebExchange exchange) {

if(size > signalHubPullConfig.getMaxNumberPage()) throw new PDNDGenericException(SIZE_NOT_VALID, SIZE_NOT_VALID.getMessage(), HttpStatus.BAD_REQUEST);
final Long finalSize = (size == 0 || size > signalHubPullConfig.getMaxNumberPage()) ? signalHubPullConfig.getMaxNumberPage() : size;

return Utility.getPrincipalFromSecurityContext()
Expand Down

0 comments on commit 5a80ae6

Please sign in to comment.