LoggingInterceptor icon indicating copy to clipboard operation
LoggingInterceptor copied to clipboard

Please remove the escape character in the json url

Open ZevShiShi opened this issue 4 years ago • 0 comments

Please remove the escape character in the json url, it will affect the http url preview, it is caused by jsonObject or JsonArray, for example: http:\/\/xx.xxx.xxx\/image\/20210114\/5beaba40044e421f8dbad2b0e5726d42.jpg, \/Replace with/

Printer.class

        private fun getJsonString(msg: String): String {
            var message: String
            message = try {
                when {
                    msg.startsWith("{") -> {
                        val jsonObject = JSONObject(msg)
                        jsonObject.toString(JSON_INDENT)
                    }
                    msg.startsWith("[") -> {
                        val jsonArray = JSONArray(msg)
                        jsonArray.toString(JSON_INDENT)
                    }
                    else -> {
                        msg
                    }
                }
            } catch (e: JSONException) {
                msg
            } catch (e1: OutOfMemoryError) {
                OOM_OMITTED
            }
             // TODO: 2021/1/18 Add code here  
            if (message.indexOf("\\/") != -1) {
                message = message.replace("\\/", "/")
            }
            return message
        }

ZevShiShi avatar Jan 18 '21 08:01 ZevShiShi