I'm working on my android project and I'm making a request function for uploading file that makes request as given below,
httpClient.put(uri) {
body = MultiPartFormDataContent(formData {
append("file", fileContent, Headers.build {
append(HttpHeaders.ContentType, fileMimeType)
append(HttpHeaders.ContentDisposition, ContentDisposition.File.withParameter(ContentDisposition.Parameters.FileName, fileOriginalName))
})
})
}
So as you can see this request has a ContentType header, but I already declared ContentType header in my Ktor HttpClient,
install(DefaultRequest) {
url {
protocol = URLProtocol.HTTP
host = baseURL
}
headers {
append(HttpHeaders.ContentType, ContentType.Application.Json)
append(HttpHeaders.Authorization, accessToken)
append(USER, user)
}
}
So my question is which ContentType is my request going to take? if it can't take the ContentType that I specified in my request function then how can I make it accept ContentType different than default one?