Jeremy
07/17/2020, 1:57 PMorg.springframework.web.reactive.function.UnsupportedMediaTypeException: Content type 'text/html;charset=utf-8' not supported for bodyType
.
Here's the service:
val client = WebClient.builder()
.baseUrl(apiUrl)
.defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.ALL_VALUE)
.defaultHeader("X-API-TOKEN", apiToken)
.build()
return client.get()
.uri("/$directoryId/mailinglists/$mailingListId")
.accept(MediaType.APPLICATION_JSON, MediaType.TEXT_HTML)
.acceptCharset(Charset.forName("UTF-8"))
.retrieve()
.bodyToMono(GetMailingListResponse::class.java)
Here's the controller:
@GetMapping("/directories/{directoryId}/mailinglists/{mailingListId}")
fun handle(@PathVariable directoryId: String, @PathVariable mailingListId: String): Mono<ResponseEntity<GetMailingListResponse>> {
val resp = service.createMailingList(directoryId, mailingListId)
return resp.map {
body -> ResponseEntity.ok(body)
}
}
Any help would be appreciated.Arian Stolwijk
07/17/2020, 3:00 PM