URL编码后的400个错误请求

问题描述 投票:-2回答:2

我在我的java代码中使用REST Web服务。在调用Rest Web服务之前,我正在通过java.net.URLEncoder对我的查询参数进行编码

但是由于400请求异常请求失败

编码前的URL:host?limit=200&filter=published ge "2017-12-15T16:50:34.034Z" and (action.objectType eq "core.user_group_member.user_add" or action.objectType eq "core.user_group_member.user_remove")

解码后的URL:%3Flimit%3D200%26filter%3Dpublished%20ge%20%222017-12-15T16%3A50%3A34.034Z%22%20and%20%28action.objectType%20eq%20%22core.user_group_member.user_add%22%20or%20action.objectType%20eq%20%22core.user_group_member.user_remove%22%29

我从邮差休息客户端工具尝试相同,没有编码的网址工作和编码网址失败400错误请求错误。

java rest postman
2个回答
0
投票

“limit = 200&filter =”不需要编码。


0
投票

postman中,您需要手动编码相关参数的值,如下所示:

右键单击一段选定的文本,然后选择“EncodeURIComponent”以手动编码参数值。

© www.soinside.com 2019 - 2024. All rights reserved.