All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hp.message.convert.FastJsonRequestConverter Maven / Gradle / Ivy

There is a newer version: 1.2.1
Show newest version
package com.hp.message.convert;

import com.alibaba.fastjson.JSON;
import okhttp3.MediaType;
import okhttp3.RequestBody;
import retrofit2.Converter;

import java.io.IOException;

/**
 * @author 尚肖磊
 * @create 2021-06-10 18:33
 * @Description: api请求转换类
 */
public class FastJsonRequestConverter implements Converter {
    private static final MediaType MEDIA_TYPE = MediaType.parse("application/json; charset=UTF-8");

    @Override
    public RequestBody convert(T value) throws IOException {
        return RequestBody.create(MEDIA_TYPE, JSON.toJSONBytes(value));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy