Browse Source

fix check multipart data

herlanS_ 3 năm trước cách đây
mục cha
commit
cb3de34306

+ 4 - 1
src/main/kotlin/co/id/datacomsolusindo/ipphonebridge/BridgeFIlter.kt

@@ -6,7 +6,6 @@ import org.apache.logging.log4j.LogManager
 import org.springframework.core.Ordered
 import org.springframework.core.annotation.Order
 import org.springframework.core.io.ResourceLoader
-import org.springframework.http.HttpHeaders
 import org.springframework.http.HttpMethod
 import org.springframework.http.HttpStatus
 import org.springframework.messaging.simp.SimpMessagingTemplate
@@ -82,7 +81,10 @@ class BridgeFilter(private val template: SimpMessagingTemplate, val resourceLoad
 
                     rb.queryString = req.queryString
 
+                    println("content type = " + req.contentType)
+
                     if (req.contentType?.toLowerCase()?.contains("multipart/form-data") == true) {
+                        println("this is multipart")
                         rb.parts =
                             req.parts.map {
                                 val subFilename = if (it.submittedFileName == null) {
@@ -95,6 +97,7 @@ class BridgeFilter(private val template: SimpMessagingTemplate, val resourceLoad
                                 FilePart(it.name, subFilename, fb64)
                             }.toMutableList()
                     } else {
+                        println("not multipart")
                         val body = req.reader.lines().toList().joinToString(System.lineSeparator())
                         rb.body = body
                     }