Package com.ayvytr.okhttploginterceptor

Types

LoggingInterceptor
Link copied to clipboard
class LoggingInterceptor @JvmOverloads constructor(showLog: Boolean, isShowAll: Boolean, tag: String, priority: Priority, visualFormat: Boolean, maxLineLength: Int, printer: IPrinter?) : Interceptor

OkHttp拦截器,有打印请求头,请求体,响应头,响应体的功能,3.0.0开始精简了配置,打印模式精简为2种,详细配置 见参数说明.

Priority
Link copied to clipboard
enum Priority : Enum<Priority>

Functions

bodyString
Link copied to clipboard
fun RequestBody.bodyString(): String
fun ResponseBody.bodyString(): String
formatAsPossible
Link copied to clipboard
fun RequestBody.formatAsPossible(visualFormat: Boolean = true, maxLineLength: Int = LoggingInterceptor.MAX_LINE_LENGTH): List<String>
fun ResponseBody.formatAsPossible(visualFormat: Boolean = true, maxLineLength: Int = LoggingInterceptor.MAX_LINE_LENGTH): List<String>
fun String.formatAsPossible(visualFormat: Boolean, contentType: MediaType?, maxLineLength: Int = LoggingInterceptor.MAX_LINE_LENGTH): List<String>
isFile
Link copied to clipboard
fun MediaType.isFile(): Boolean
isForm
Link copied to clipboard
fun MediaType.isForm(): Boolean
isGuessJson
Link copied to clipboard
fun String.isGuessJson(): Boolean
isHtml
Link copied to clipboard
fun MediaType.isHtml(): Boolean
isJson
Link copied to clipboard
fun MediaType.isJson(): Boolean
isMedia
Link copied to clipboard
fun MediaType.isMedia(): Boolean
isParsable
Link copied to clipboard
fun MediaType.isParsable(): Boolean

是否可以解析

isPlain
Link copied to clipboard
fun MediaType.isPlain(): Boolean
isText
Link copied to clipboard
fun MediaType.isText(): Boolean
isUnreadable
Link copied to clipboard
fun MediaType.isUnreadable(): Boolean
isXml
Link copied to clipboard
fun MediaType.isXml(): Boolean
isZip
Link copied to clipboard
fun MediaType.isZip(): Boolean
jsonFormat
Link copied to clipboard
fun String.jsonFormat(): List<String>
xmlFormat
Link copied to clipboard
fun String.xmlFormat(): List<String>

xml格式化不完善,暂时不改了