Closed benman1 closed 4 years ago
I've got a branch to make http.get return an optional BTW.
I had it on a branch for ever... It's an easy fix.
Closed. LibCurl dependency has been removed and option propagation has been fixed.
For usage information, quit V REPL using `exit` and use `v help`
V 0.1.27 06540f0
Use Ctrl-C or `exit` to exit
>>> import net.http
>>> data := http.get('https://vlang.io/utc_now')?
>>> data.text
1590301090
>>>
V version: 760034b6b177e8cafa175a969106e70de65a7eb6 (July 19, as on github)
Ubuntu 18.04
What did you do? In the REPL, I tried to execute the example from the documentation.
What did you expect to see?
v
>> data := http.get('https://vlang.io/utc_now')?
>> data
'1551205308'
What did you see instead? First attempt:
>>> data := http.get('https://vlang.io/utc_now')?
undefined:
http`
>>> import http~~~~http is part of the v standard library, so I would have expected to see at least a warning during installation that I need to install more libraries. I installed one of the libcurl-dev packages
sudo apt install libcurl4-gnutls-dev
Next I got:
>>> import http
>>> data := http.get('https://vlang.io/utc_now')?
.neXT=.eof
panic: .vrepl_temp.v:2
unexpected token:
?``So I tried without the ?
>>> data := http.get('https://vlang.io/utc_now')
>>> data
1563531174
So that's good, however:
>>> print(data)
Nothing...
>>> println(data)
1563531203
>>> println('hello, world')
hello, world
>>> print('hello, world')
>>> C.fflush(stdout)
(nil)