Arc Forumnew | comments | leaders | submitlogin
3 points by krapp 2292 days ago | link | parent

I got an error saying #t was an unknown type when I tried to do a boolean check on it, as it was passed from a JSON response. It's the reason I started this thread to begin with.


2 points by hjek 2292 days ago | link

Would you mind preparing a simple code example to show this issue? I'm not sure exactly what you are doing.

-----

2 points by krapp 2292 days ago | link

Sure... the if statement in verify-captcha is where the problem occurs.

It currently works but that's only because json.rkt has been modified.

    (def post-getjson (url params (o port stdin))
      (fromstring (post-url url params) 
        (read-json (port))))

    (def recaptcha-response (s r)
      (post-getjson "https://www.google.com/recaptcha/api/siteverify"
      (list 'secret s 'response r)))

    (def verify-captcha (req)
      (do
        (= resp (recaptcha-response recaptcha-secret* 
        (alref (req 'args) "g-recaptcha-response")))
      (if resp!success 
        (pr "success") 
        (pr "failure"))))

-----

2 points by hjek 2292 days ago | link

> when I tried to do a boolean check on it,

Can I ask how you did a "boolean check" on #t?

-----