Add curl sketch.
This commit is contained in:
parent
d4fb4680a5
commit
085f60ab4f
15
sketching/curl.dms
Normal file
15
sketching/curl.dms
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
use std::http::jsonClient
|
||||||
|
|
||||||
|
fn main = jsonClient() # json client
|
||||||
|
post 'http://localhost:1234/login', username: 'test', password: 'test' # Either<Err, Response>
|
||||||
|
-> || ( it.body.accessToken ) # Either<Error, *>
|
||||||
|
|> println # IO
|
||||||
|
()
|
||||||
|
|
||||||
|
# Without operators
|
||||||
|
|
||||||
|
fn main = jsonClient()
|
||||||
|
post 'http://localhost:1234/login', username: 'test', password: 'test'
|
||||||
|
map || ( it.body.accessToken )
|
||||||
|
fold println
|
||||||
|
()
|
Loading…
Reference in New Issue
Block a user