Reputation: 186103
For example, when we parse this query string:
foo&bar=&baz=123
Firefox’s implementation of the standard URLSearchParams
type (spec) assigns an empty string value to both foo
and bar
:
Does this mean that foo
and foo=
are effectively the same inside a query string? Or is it a bug in Firefox?
Upvotes: 1
Views: 725
Reputation: 5792
The answer is in the specification in the link that you post...
For each byte sequence bytes in sequences, run these substeps:
If bytes is the empty byte sequence, run these substeps for the next byte sequence.
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.Otherwise, let name have the value of bytes and let value be the empty byte sequence
so... key and key= are the same... this is not a bug.
Upvotes: 1