Coder Social home page Coder Social logo

Comments (8)

wyouflf avatar wyouflf commented on July 3, 2024

特殊需求请自己实现:

  1. query参数的话自己在url后面直接加上这个特殊参数: url?p=1&p=2&p=3
  2. body参数模仿源码中BodyRequestBody实现一个可添加List参数的RequestBody,
    然后params.setRequestBody(customBody)

但是最好避免这种设计方法:
简答一点的方式: p=1,2,3
服务端拿到p后: array = p.split(',')
更少的传输字节, 更快的解析速度( p.split(',') 比将 p=1&p=2&p=3 解析为list快),

from xutils3.

bacy avatar bacy commented on July 3, 2024
 我之前在requestParams的getEntity方法中添加过一个提交json格式的功能。 requestParams可以设置contentType,默认是application/x-www-form-urlencoded,bodyparams转换成key,value形式提交。如果设置成application/json的话,bodyparams会转换成json字符串提交
 else if (TYPE_RAW_JSON.equals(contentType)) {
        try {
            result = new JsonTextEntity(getBodyJsonText(), charset);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    } else if (bodyParams != null && !bodyParams.isEmpty()) {
        result = new BodyParamsEntity(bodyParams, charset);
    }

#######################################
Re: 已有这样的功能: params.setBodyContent(jsonStr)
#######################################
嗯,开始没注意看,还停留在xUtils2上

from xutils3.

cekowu avatar cekowu commented on July 3, 2024

谢谢,字符串数组这样拼写是可以的,如果是文件数组的话,有什么好的建议了

from xutils3.

cekowu avatar cekowu commented on July 3, 2024

文件的话只能再加一种类型

from xutils3.

cekowu avatar cekowu commented on July 3, 2024

我测试了一下文件上传好像有问题,上传不了文件,还在分析当中

#######################################################
Re: http标准协议没有文件数组类型的表单, 多文件上传, 请使用multipart表单, 看示例代码中的用法.

from xutils3.

cekowu avatar cekowu commented on July 3, 2024

我已经修改源码支持了数组类型

from xutils3.

wyouflf avatar wyouflf commented on July 3, 2024

升级到3.1.0, 开始支持数组参数(重名的参数).

from xutils3.

cekowu avatar cekowu commented on July 3, 2024

我已经更新到了3.1,正测试中,你们很神速

from xutils3.

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.