POST改造,带编码

时间:2018-02-01 12:49:40

标签: android retrofit2

我发送POST请求并传递链接,但所有{}和[]都在%7B中加密,%22我试过URLDecoder没有帮助,请告诉我如何解决它。谢谢。

@Multipart
    @POST("entity/api/xm-entities/self/links/targets/{link}")
    Call<ResponseBody> sendPhoto(
            @Header("Authorization") String token,
            @Path("link") String link,
            @Part MultipartBody.Part image);

尝试解码

String link = obj.toString();
    String afterDecode = null;

    try {
        afterDecode = URLDecoder.decode(link, "UTF-8");
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }

链接尝试发送

{"typeKey":"typekeyName","target":{"typeKey" : "typeKeyName","name":"<filename>","tags":[{"name": "photo_name"}]}}

发送后

%7B%22typeKey%22:%22typekeyName%22,%22target%22:%7B%22typeKey%22:%22typekeyName%22,%22name%22:%22%3Cfilename%3E%22,%22tags%22:[%7B%22name%22:%22photo_name%22%7D]%7D%7D}

0 个答案:

没有答案