"key" 和 "key=" URL 查询字符串之间有区别吗?

Is there a difference between a "key" and "key=" URL query string?

例如,当我们解析这个查询字符串时:

foo&bar=&baz=123

Firefox 对标准 URLSearchParams 类型 (spec) 的实现将空字符串值分配给 foobar:

这是否意味着 foofoo= 在查询字符串中实际上是相同的?还是 Firefox 中的错误?

答案在 link 的规范中,您 post...

For each byte sequence bytes in sequences, run these substeps:

  1. If bytes is the empty byte sequence, run these substeps for the next byte sequence.

  2. If bytes contains a =, then let name be the bytes from the start of bytes up to but excluding its first =, and let value be the bytes, if any, after the first = up to the end of bytes. If = is the first byte, then name will be the empty byte sequence. If it is the last, then value will be the empty byte sequence.

  3. Otherwise, let name have the value of bytes and let value be the empty byte sequence

所以...key 和 key= 相同...这不是错误。