Browse files

Example for LibCurl::HTTP subroutines

  • Loading branch information...
CurtTilmes committed May 12, 2017
1 parent 2852659 commit cc1d02c87ec197d256f58988f867e8c6d3d3ce67
Showing with 19 additions and 0 deletions.
  1. +19 −0 eg/http.pl6
@@ -0,0 +1,19 @@
use v6;
use LibCurl::HTTP :subs;
# Just GET content (will return Failure on failure):
say get '';
# GET and decode received data as JSON:
say jget('')<args><foo>;
# POST content (query args are OK; pass form as named args)
say post '', :some<form>, :42args;
# And if you need headers, pass them inside a positional Hash:
say post '', %(:Some<Custom-Header>),
:some<form>, :42args;
# Same POST as above + decode response as JSON
say jpost('', :some<form-arg>)<form><some>;

0 comments on commit cc1d02c

Please sign in to comment.