ring

J 2025-03-19T09:53:32.638219Z

Hi guys! In this example: the param baz is not included in the query-params map. I use the middleware wrap-params of ring 1.13.0 . It's normal?

wevrem 2025-03-19T14:02:43.575999Z

What value for the key "baz" (or maybe it ends up as :baz) are you expecting to see?

J 2025-03-19T14:04:17.503899Z

I'm expected to see something like {"baz" ""}since query string like ?baz&foo=1 produce {"baz" "" "foo" "1"}

wevrem 2025-03-19T14:11:43.109439Z

Have you checked out the source for wrap-params? Does that give you an idea of what might be going on?

J 2025-03-19T14:12:54.418409Z

Yes and maybe it's a bug

weavejester 2025-03-19T14:45:09.109079Z

If you want {"baz" "", "foo" "1"} the query string would be: ?baz=&foo=1. Why do you expect ?baz&foo=1 to work?

J 2025-03-19T14:48:27.115589Z

Yes ?baz&foo=1 works well but ?baz produce {} . I'm expecting {"baz" ""}

weavejester 2025-03-19T14:48:44.385319Z

But why do you expect that to work?

weavejester 2025-03-19T14:49:06.113129Z

?baz= would produce {"baz" ""}

weavejester 2025-03-19T14:49:42.462489Z

Oh, wait, you're saying ?baz&foo=1 works? Let me quickly check that.

weavejester 2025-03-19T14:51:55.122969Z

So it does. That looks like a bug - ?baz&foo=1 should produce {"foo" "1"}

J 2025-03-19T14:54:20.195009Z

I think it's good that ?baz&foo=1 produce {"baz" "" "foo" 1} but only ?baz should be produce {"baz" ""} since ?baz is considered valid.

weavejester 2025-03-19T14:54:42.853799Z

Why is it valid?

J 2025-03-19T15:10:00.666049Z

It might refer to boolean kind value

weavejester 2025-03-19T15:10:57.197089Z

Is there any such thing in form-encoding? Is there an RFC or definition you're looking at?

weavejester 2025-03-19T15:17:59.522989Z

Ah, found it. It's surprising difficult to find an authorative definition of form encoding online. You're correct - according to https://url.spec.whatwg.org/#urlencoded-parsing the query string ?baz should be encoded as {"baz" ""}.

J 2025-03-19T15:18:36.646229Z

I check this RFC https://www.rfc-editor.org/rfc/rfc3986#section-3.4. This doesn't mandate a key=value even if this is the popular format

weavejester 2025-03-19T15:20:23.341489Z

Yes, the URI RFC doesn't specify that. The WHATWG URL definition does though, and that's the only authorative source I could find.

weavejester 2025-03-19T15:22:08.309419Z

Could you open an issue for this on Ring?

J 2025-03-19T15:22:31.522869Z

Yes sure

weavejester 2025-03-19T15:22:46.033829Z

Many thanks.

weavejester 2025-03-19T15:28:14.995819Z

Thanks!