purescript-contrib / purescript-affjax

An asynchronous AJAX library built using Aff.
Apache License 2.0
122 stars 79 forks source link

Handle ill-formed `FormURLEncoded` data #139

Closed menelaos closed 5 years ago

menelaos commented 5 years ago

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 5 years ago

Yikes, well spotted. Untyped unsafeCoerce strikes again!

garyb commented 5 years ago

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

menelaos commented 5 years ago

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 5 years ago

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