Skip to content

@Part file: List<PartData> not work #855

@xiaoyvyv

Description

@xiaoyvyv

Ktorfit version

2.5.2

What happened and how can we reproduce this issue?

The @Part file: List<PartData> not work with @Multipart, and the key: file,HttpHeaders.ContentType,HttpHeaders.ContentDisposition disappear

    @Multipart
    @POST("search")
    suspend fun fetchCharacterInfoFromImage(
        @Part file: List<PartData>,
        @Part("model") model: String,
        @Part("ai_detect") aiDetect: Boolean = false,
        @Part("is_multi") showMulti: Boolean = true,
    ): ComposeTraceCharacter



    client.traceMoeApi.fetchCharacterInfoFromImage(
        model = "xxx",
        aiDetect = false,
        showMulti = true,
        file = formData {
            append("file", byteArray, Headers.build {
                append(HttpHeaders.ContentType, "image/jpeg")
                append(HttpHeaders.ContentDisposition, "filename=\"image.jpeg\"")
            })
        }
    )

Image

What did you expect to happen?

正确上传文件

Is there anything else we need to know about?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions