David Gethers
03/03/2020, 3:02 AMfun redirectToUrl(@PathVariable urlId: String): MutableHttpResponse<URL>? {
val result: Optional<UrlMap> = urlMapRepository.findById(urlId)
return if (result.isPresent) {
val record: UrlMap = result.get()
val url = URI(record.url!!)
record.visits = record.visits + 1
urlMapRepository.update(record)
HttpResponse.redirect<URL>(url)
} else {
HttpResponse.notFound()
}
}
When using RxHttpClient the response contains the html from the redirected page. Ultimately the only thing I really want to test for is a 302 redirect (if I have an internet connection I get a 200 for the redirected page). I also want the client to work without an internet connection. I hope this isn't a dumb question.