#Testing webclient
7 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @timid copper! Please use
/closeor theClose Postbutton above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Something like that for example
return webClient.get()
.uri(uriBuilder -> uriBuilder
.path("/users/{username}/repos")
.build(request.nickname()))
.retrieve()
.onStatus(HttpStatusCode::is4xxClientError, clientResponse ->
Mono.error(new UserNotFoundException(String.format("User %s doesn't exist", request.nickname()))))
.bodyToFlux(RepositoryData.class)
.filter(repositoryData -> !repositoryData.fork())
.flatMap(repositoryData -> getBranchesAndSHAs(repositoryData)
.collectList()
.map(branchDataList -> new GetRepoResponse(repositoryData.name(), repositoryData.owner().login(), branchDataList)))
.collectList();