purescript-contrib/purescript-affjax

Handle ill-formed `FormURLEncoded` data

menelaos opened this issue · 4 comments

A fairly recent commit in purescript-form-urlencoded changed the type signature of the encode function from ... -> String to ... -> Maybe String. This trips up the extractContent function in purescript-affjax. Due to the use of unsafeToForeign, the compiler won't notice.

The sanitization of the FormURLEncoded data could probably also be done in purescript-form-urlencoded (smart constructors or similar) but, either way, I guess the user should be prevented from sending ill-formed requests.
Thanks for reading!

garyb commented

Yikes, well spotted. Untyped unsafeCoerce strikes again!

garyb commented

Ah, this does only arise if the dependency versions are overridden right now, at least.

Yes, sorry, I should have mentioned that I was using affjax v9.0.0 and form-urlencoded v5.0.0. They were in the same package set, but I see that you took care of that, too :-) Thanks!

garyb commented

I'll get an update out this weekend, just ran out of time last night 🙂