diff --git a/application/aam-backend-service/src/main/kotlin/com/aamdigital/aambackendservice/notification/core/DefaultTriggerWebhookUseCase.kt b/application/aam-backend-service/src/main/kotlin/com/aamdigital/aambackendservice/notification/core/DefaultTriggerWebhookUseCase.kt index 3f0317c..69e6204 100644 --- a/application/aam-backend-service/src/main/kotlin/com/aamdigital/aambackendservice/notification/core/DefaultTriggerWebhookUseCase.kt +++ b/application/aam-backend-service/src/main/kotlin/com/aamdigital/aambackendservice/notification/core/DefaultTriggerWebhookUseCase.kt @@ -1,12 +1,12 @@ package com.aamdigital.aambackendservice.notification.core -import com.aamdigital.aambackendservice.couchdb.core.getEmptyQueryParams import com.aamdigital.aambackendservice.domain.DomainReference import com.aamdigital.aambackendservice.notification.core.event.NotificationEvent import org.slf4j.LoggerFactory import org.springframework.http.HttpHeaders import org.springframework.http.HttpMethod import org.springframework.http.MediaType +import org.springframework.web.reactive.function.BodyInserters import org.springframework.web.reactive.function.client.WebClient import reactor.core.publisher.Mono import java.net.URI @@ -23,9 +23,6 @@ class DefaultTriggerWebhookUseCase( webhookRef = DomainReference(notificationEvent.webhookId) ) .flatMap { webhook -> - val queryParams = getEmptyQueryParams() - queryParams.set("calculation_id", notificationEvent.calculationId) - val uri = URI( uriParser.replacePlaceholder( webhook.target.url, @@ -41,12 +38,18 @@ class DefaultTriggerWebhookUseCase( it.scheme(uri.scheme) it.host(uri.host) it.path(uri.path) - it.queryParams(queryParams) it.build() } .headers { it.set(HttpHeaders.AUTHORIZATION, "Token ${webhook.authentication.secret}") } + .body( + BodyInserters.fromValue( + mapOf( + Pair("calculation_id", notificationEvent.calculationId) + ) + ) + ) .accept(MediaType.APPLICATION_JSON) .exchangeToMono { response -> response.bodyToMono(String::class.java)