Giter Site home page Giter Site logo

Comments (6)

getActivity avatar getActivity commented on May 24, 2024

小伙子,你是想修改 RequestBody 的 Content-Type 请求头的值对吧?

from easyhttp.

zhaidw avatar zhaidw commented on May 24, 2024

Content-Type [可以改,只要是body里面不是预期的,您可以理解我post的格式不是文本json,也不是form那种kv键值对;就是一堆二进制字节,目前看看是被当成form处理了,见截图:
http1

from easyhttp.

zhaidw avatar zhaidw commented on May 24, 2024

使用原始的 okhttp 对应代码类似如下:


	byte[] dataByte=null; // 数据赋值
        RequestBody requestBody = RequestBody.create(MediaType.parse("application/octet-stream"), dataByte);


        Request request = new Request.Builder().url(url)
                .header("deviceId", "header1")
                .header("User-Agent", "header2")
                .post(requestBody).build();


        Call call = okHttpClient.newCall(request);
        call.enqueue(callback);

debug 打印如下:

http-bin

from easyhttp.

getActivity avatar getActivity commented on May 24, 2024

小伙子,我理解你说的是想自定义 RequestBody 对吧?

from easyhttp.

zhaidw avatar zhaidw commented on May 24, 2024

是的,目前的api看起来无法支持哦。

from easyhttp.

getActivity avatar getActivity commented on May 24, 2024

@zhaidw 框架文档上面有写,你回去找找

from easyhttp.

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.