Reham Galal
10/30/2024, 12:01 PMcurl "<https://httpbin.org/post>" -X POST -H "Accept: application/json" -H "Accept-Charset: UTF-8" -H "Content-Type: multipart/form-data; boundary=29d61685-228ec613-44759624-46d5b594-3563b24e-4de1ab26749622364911b1e3-" -H "Content-Length: 491" -H "User-Agent: Ktor client" -d "--29d61685-228ec613-44759624-46d5b594-3563b24e-4de1ab26749622364911b1e3-
Content-Disposition: form-data; name=store_img_profile; filename=image_file.jpg
Content-Type: image/jpg
Content-Length: 210
file:///Users/mac/Library/Developer/CoreSimulator/Devices/121666D6-FC09-4296-B9A2-50FC86B6E9FE/data/Containers/Data/Application/5218EFEE-1666-4829-B16D-E346D65E6923/tmp/1D30F36C-3B12-4E42-95E7-8F849D9FA580.jpeg
--29d61685-228ec613-44759624-46d5b594-3563b24e-4de1ab26749622364911b1e3---
"
it's working fine on postman, and it's succeeding on android, but in ios it's returning timeout
I have tried to upgrade the ktor version to
3.0.0-rc-1
but still the same behaviour what could be the issue hereAleksei Tirman [JB]
10/30/2024, 2:12 PMReham Galal
10/30/2024, 2:14 PMHttpClient.submitFormWithBinaryData(
url = url,
formData = formData {
append("\"store_img_profile\"", body, Headers.build {
append(HttpHeaders.ContentType, "image/jpeg")
append(HttpHeaders.ContentDisposition, "filename=\"image_file.jpeg\"")
})
}
)
Mofe Ejegi
10/30/2024, 3:35 PMReham Galal
10/30/2024, 3:36 PMMofe Ejegi
10/30/2024, 3:37 PMReham Galal
10/30/2024, 3:38 PMAleksei Tirman [JB]
10/31/2024, 8:52 AMReham Galal
10/31/2024, 8:54 AMReham Galal
10/31/2024, 8:55 AMAleksei Tirman [JB]
10/31/2024, 8:56 AMAleksei Tirman [JB]
10/31/2024, 8:57 AMMofe Ejegi
10/31/2024, 8:58 AMReham Galal
10/31/2024, 8:59 AMAleksei Tirman [JB]
11/01/2024, 7:47 AMbody
variable is populated?Reham Galal
11/01/2024, 9:54 AMval httpClientPrivate = httpClientBuilder {
expectSuccess = true
install(ContentNegotiation) {
json(Json {
ignoreUnknownKeys = true
explicitNulls = false
})
}
defaultRequest {
url {
url("<https://httpbin.org/post>")
header(HttpHeaders.ContentType, "application/json")
}
}
install(HttpTimeout) {
requestTimeoutMillis = 3000
connectTimeoutMillis = 3000
socketTimeoutMillis = 3000
}
install(Logging) {
logger = object : Logger {
override fun log(message: String) {
logRequest(message)
}
}
level = LogLevel.ALL
}
HttpResponseValidator {
validateResponse { response ->
if (!response.status.isSuccess()) {
val failureReason = when (response.status) {
HttpStatusCode.BadRequest -> BAD_REQUEST
HttpStatusCode.Unauthorized -> UNAUTHORIZED
HttpStatusCode.Forbidden -> "${response.status.value} $FORBIDDEN"
HttpStatusCode.NotFound -> NOT_FOUND
HttpStatusCode.RequestTimeout -> TIMEOUT
in HttpStatusCode.InternalServerError..HttpStatusCode.GatewayTimeout -> "${response.status.value} $SERVER_ERROR"
else -> NETWORK_ERROR
}
throw HttpExceptions(
response = response,
failureReason = failureReason,
cachedResponseText = response.bodyAsText(),
)
}
}
}
}
even if i sent binaryArrayof(0)
it's the same response