We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
result: on postman I only get information about the HttpStatus expected: trigger an exception and control it
First test manage to trigger de custom exception but Auth Exception Controller does not capture it.
@Override public GatewayFilter apply(Config config) { return (((exchange, chain) -> { if(!exchange.getRequest().getHeaders().containsKey(HttpHeaders.AUTHORIZATION)) return onError(exchange, HttpStatus.BAD_REQUEST); String tokenHeader = exchange.getRequest().getHeaders().get(HttpHeaders.AUTHORIZATION).get(0); String [] chunks = tokenHeader.split(" "); if(chunks.length != 2 || !chunks[0].equals("Bearer")) return onError(exchange, HttpStatus.BAD_REQUEST); return webClient.build() .post() .uri("http://auth-service/auth/validate?token=" + chunks[1]) .bodyValue(new HttpRequestDTO(exchange.getRequest().getPath().toString(), exchange.getRequest().getMethod().toString())) .retrieve().bodyToMono(TokenDTO.class) .map(t -> { t.getToken(); return exchange; }).flatMap(chain::filter); })); }
public Mono<Void> onError(ServerWebExchange exchange, HttpStatus status){ ServerHttpResponse response = exchange.getResponse(); response.setStatusCode(status); return response.setComplete(); }
The text was updated successfully, but these errors were encountered:
plopezgit
No branches or pull requests
result: on postman I only get information about the HttpStatus
expected: trigger an exception and control it
First test manage to trigger de custom exception but Auth Exception Controller does not capture it.
The text was updated successfully, but these errors were encountered: