Skip to content

Commit

Permalink
Merge pull request #59 from KjellBerlin/update-slack-payload-2
Browse files Browse the repository at this point in the history
Slack payload request param in x-www-form-urlencoded
  • Loading branch information
KjellBerlin authored Aug 9, 2024
2 parents e1d93a0 + 9b27ba8 commit 1eb1e4f
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.carbonara.core.delivery
import com.carbonara.core.order.OrderService
import mu.KotlinLogging
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestParam
import org.springframework.web.bind.annotation.RestController

@RestController
Expand All @@ -13,14 +12,18 @@ class SlackDeliveryWebhookController(

// Potential dos attack endpoint, introduce rate limiting

@PostMapping("/slack-delivery-status")
suspend fun handleSlackWebhook(@RequestParam("payload") payload: String) {
@PostMapping("/slack-delivery-status", "application/x-www-form-urlencoded")
suspend fun handleSlackWebhook(payload: SlackWebhookRequestBody) {
log.info("--Start Slack--")
log.info(payload)
log.info(payload.payload)
log.info("--End Slack--")
}

companion object {
private val log = KotlinLogging.logger {}
}
}

data class SlackWebhookRequestBody(
val payload: String
)

0 comments on commit 1eb1e4f

Please sign in to comment.