示例端点:
https://localhost:4200/test/index.html?param1=username%2passw0rd&baseApi=https://someOtherService/APIBase.jsp?INT/
Run Code Online (Sandbox Code Playgroud)
当我点击上面的端点时。我的网址被转换成这个...
https://localhost:4200/test/index.html?param1=username%2passw0rd&baseApi=https:%2F%2FsomeOtherService%2FAPIBase.jsp
Run Code Online (Sandbox Code Playgroud)
正如您在 baseApi 参数中所看到的,“/”被转换为“%2F”并且值“?INT/”也被删除了。
如何防止 URL 转换“/”并为第二个参数“baseApi”中的值保留“?INT/”值。
Aus*_*nch 10
你没有。如果允许,它将破坏互联网。
更多细节:
第 1 点:情况并非总是如此,许多 API 框架会自动解码查询字符串。
如果您需要传递完整的 URL,请确保它已正确编码:
console.log("https://localhost:4200/test/index.html?" + encodeURIComponent("param1=username%2passw0rd&baseApi=https://someOtherService/APIBase.jsp?INT/"));
Run Code Online (Sandbox Code Playgroud)
https://localhost:4200/test/index.html?param1%3Dusername%252passw0rd%26baseApi%3Dhttps%3A%2F%2FsomeOtherService%2FAPIBase.jsp%3FINT%2F
| 归档时间: |
|
| 查看次数: |
1997 次 |
| 最近记录: |