This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects

Resolve "Sharing Plattform: Prüfung: Gitlab Login für Simon in Produktion funktioniert nicht zuverlässig."

Files
14
@@ -3,6 +3,7 @@ package at.ac.uibk.gitsearch.config;
import at.ac.uibk.gitsearch.edu_sharing.model.Authority;
import at.ac.uibk.gitsearch.properties.ApplicationProperties;
import at.ac.uibk.gitsearch.service.edu_sharing.EduSharingConfiguration;
import at.ac.uibk.gitsearch.service.edu_sharing.EduSharingUnavailableException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -64,6 +65,21 @@ public class EduSharingApiConfiguration {
.builder()
.baseUrl(eduSharingUrl)
.filter(new EduSharingLogger())
.filter((request, next) ->
next
.exchange(request)
.flatMap(response -> {
if (response.statusCode().value() == 503) {
return response
.bodyToMono(String.class)
.flatMap(errorBody -> {
return Mono.error(new EduSharingUnavailableException("Error response: " + errorBody));
});
} else {
return Mono.just(response);
}
})
)
.defaultHeaders(header -> header.setBasicAuth(user, password))
.build();
}