Arjan van Wieringen
10/20/2024, 9:31 AMPartData
has the following in the comments:
/**
* Represents a multipart/form-data entry. Could be a [FormItem] or [FileItem].
* @property dispose to be invoked when this part is no longed needed
* @property headers of this part, could be inaccurate on some engines
*/
public sealed class PartData(public val dispose: () -> Unit, public val headers: Headers)
• "Property Headers of this part, could be inaccurate": What does this mean? How can it be inaccurate? In which cases?
• "Represents a multipart/form-data entry. Could be a [FormItem] or [FileItem].", but there are more subclasses: BinaryChannelItem, BinaryItem.
• The dispose method. At which moment should it be used? I only see a reference to it in installDefaultTransformations
where parameters are added in the Parameters object. What happens if you don't dispose? Do I need to dispose? What happens with files when I dispose? Do I need to dispose in order the fields arive?
• In the docs it states: "Ktor allows you to receive form parameters sent with both x-www-form-urlencoded
and multipart/form-data
types using the receiveParameters function". So should I use receiveParameters
or receiveMultiPart
on a call? Can I receive both?Aleksei Tirman [JB]
10/21/2024, 7:41 AMSam
11/08/2024, 7:26 AMSam
11/08/2024, 7:33 AMAleksei Tirman [JB]
11/11/2024, 8:05 AMFileItem
and FormItem
. The FileItem
has the provider
method which can be used to get the ByteReadChannel
of the item. You can use the channel to read the item's body asynchronously. You can find an example of reading ByteReadChannel
by chunks in the documentation.