Coder Social home page Coder Social logo

Comments (6)

liangjingkanji avatar liangjingkanji commented on May 20, 2024

好的, 稍等我复现下问题. 仅上传文件存在这个问题是吧

from net.

XiaoWensc avatar XiaoWensc commented on May 20, 2024

是的

from net.

liangjingkanji avatar liangjingkanji commented on May 20, 2024

demo中无法复现, 你最好确认下(可能是输出日志工具的问题)或者fork仓库复现

上传文件实现代码在buildRequest, 你也可以使用断点调试查看问题

override fun buildRequest(): Request {
    val body = if (body != null) body else {
        val form = formBody.build()
        try {
            partBody.build()
            for (i in 0 until form.size) { // 如果存在文件就开始使用multiPartBody方式上传
                val name = form.name(i)
                val value = form.value(i)
                partBody.addFormDataPart(name, value)
            }
            partBody.setType(mediaType).build()
        } catch (e: IllegalStateException) {
            form
        }
    }

    return okHttpRequest.method(method.name, body)
        .url(httpUrl.build())
        .setConverter(converter)
        .build()
}

from net.

liangjingkanji avatar liangjingkanji commented on May 20, 2024

无法复现

from net.

XiaoWensc avatar XiaoWensc commented on May 20, 2024

我找到出现问题的原因了。
因为在RequestInterceptor中 buildRequest() 获取过一次Request对象,导致重复执行buildRequest(), 从而出现了相同的参数

from net.

liangjingkanji avatar liangjingkanji commented on May 20, 2024

欢迎下次讨论

from net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.