hyper icon indicating copy to clipboard operation
hyper copied to clipboard

Should we treat `+` as `%20` in uri query part?

Open paluh opened this issue 8 years ago • 3 comments

I've described details here: https://github.com/slamdata/purescript-uri/issues/38

paluh avatar Nov 18 '17 22:11 paluh

Good question. In my opinion, the purescript-uri package would be a strange place to have this "fix", at least more so than in Hyper. That said, I'm leaning towards not supporting + as encoded space in Hyper either, at least not by default. Not sure if it makes sense to have it configurable either... What do you think?

owickstrom avatar Nov 20 '17 07:11 owickstrom

@owickstrom I'm not sure how to politely continue this discussion as I've opened two different tickets on the same topic :-) I can copy all related comments from purescript-uri thread here too for completeness if you want.

Anyway, I've tested some browsers behavior and checked how other libraries are treating + in queries. You can find results of "my research" in the latest comment here: https://github.com/slamdata/purescript-uri/issues/38#issuecomment-345710976

paluh avatar Nov 20 '17 14:11 paluh

I think I'm going to provide

type Options = { replacePlus :: Boolean }                                                                                                                              
                                                                                                                                                                       
defaultOptions :: Options                                                                                                                                              
defaultOptions = { replacePlus: true }

and change

parseUrlencoded :: Options -> String -> Either String (Array (Tuple String (Maybe String))

Does it sound good to you?

paluh avatar May 31 '18 19:05 paluh