Can an equals sign appear after the first equals sign in a query parameter?

半腔热情 提交于 2019-12-10 12:55:00

问题


For example, is this a valid URL:

http://0.0.0.0:8080/auth/reset?id=AAAAAAAAAAA=&code=uX8kklWhVi-Vhp4BdMRQYBEveEdwQXBFDecLlsT6yBw=

From what I've researched it seems to be discouraged (but I haven't found anything definitive), but all the decoders I've tested it with decode it correctly. This includes:

  • Google Chrome
  • Firefox
  • NodeJS' decodeURIComponent

回答1:


The key=value format in the query component is just a convention.

The = is allowed in the query component, and it has no reserved meaning there.

So yes, it is a valid URI.

How the parameters get parsed depends on the specific implementation. As the parameters are typically separated by a &, it would make sense to interpret additional = characters as part of the value.



来源:https://stackoverflow.com/questions/42506034/can-an-equals-sign-appear-after-the-first-equals-sign-in-a-query-parameter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!