This works for me.
Best regards.
Nala Ginrut writes:
> I've tested it, guile internal server-core doesn't work too.
> So I believe Artanis has to implement its own client API to make it
> work.
> The client API is necessary, since people may need to make OAUTH.
>
> I'll add it to TODO.
>
> Best regards.
>
>
> Nala Ginrut writes:
>
>> Hi Morimer!
>> In theory, the API of (web client) like http-get should work in Ragnarok.
>> Because Ragnaork based on suspendable-ports for co-routine, and when
>> suspendable-ports is enabled, all the I/O ports defined in Guile should
>> be affected to be non-blocking.
>>
>> I'm not sure about http-request function, where did you find it?
>>
>> Anyway, if you don't insist on non-blocking, you can use guile
>> server-core to avoid non-blocking issue:
>> ------------------------cut-----------------------
>> art work -s guile
>> ------------------------end-----------------------
>>
>>
>>
>> Best regards.
>>
>>
>> Mortimer Cladwell writes:
>>
>>> Hi,
>>> Given the controller:
>>>
>>> (register-define add
>>> (lambda (rc)
>>> (let* (
>>> ;;(btc-usd 18000)
>>> (btc-usd (string->number(receive (response-status response-body)
>>> (http-request "
>>>
https://blockchain.info/q/24hrprice") response-body)))
>>> (btc-req (/ 5000 btc-usd))
>>> (currency-content (string-append " <option
>>> value=\"btc\">Bitcoin " (number->string btc-req) " BTC</option>)))
>>> (view-render "add" (the-environment)))
>>> ))
>>>
>>> If I navigate to
http://127.0.0.1:3000/register/add the browser hangs and
>>> eventually times out.
>>>
>>> At the console:
>>> Ragnarok: continue request
>>> Error: (wrong-type-arg #f Wrong type (expecting ~A): ~S (resumable
>>> continuation #<vm-continuation 7f768042f930>) (#<vm-continuation
>>> 7f768042f930>))
>>> Ingore it to avoid Ragnarok crash.
>>> main-loop again
>>>
>>> If at the REPL I evaluate (string->number (receive (response-status
>>> response-body)
>>> (http-request "
https://blockchain.info/q/24hrprice") response-body))
>>> I get a number e.g 18,123.45
>>>
>>> If I comment out (btc-usd (string->number(receive.... ) and uncomment
>>> (btc-usd 18000), the expected page is rendered properly.
>>>
>>> Is it possible to use (http-request... ) in a controller?
>>> If not is there a workaround?
>>> Thanks
>>> Mortimer
--
GNU Powered it
GPL Protected it
GOD Blessed it
HFG - NalaGinrut
Fingerprint F53B 4C56 95B5 E4D5 6093 4324 8469 6772 846A 0058