diff options
| author | Jonathan "Duke" Leto <jonathan@leto.net> | 2011-11-04 19:01:58 -0700 |
|---|---|---|
| committer | Jonathan "Duke" Leto <jonathan@leto.net> | 2011-11-04 19:01:58 -0700 |
| commit | 461cdb0f2bd22e34561eb3d8ea1b8ea6c0a4919b (patch) | |
| tree | 396eb0300b21be4376aa970350ede5564a185719 /examples/post_hook.pl | |
| parent | update gitignore (diff) | |
| download | jitterbug-461cdb0f2bd22e34561eb3d8ea1b8ea6c0a4919b.tar.gz | |
move the post hook example to a reasonable place
Diffstat (limited to 'examples/post_hook.pl')
| -rw-r--r-- | examples/post_hook.pl | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/post_hook.pl b/examples/post_hook.pl new file mode 100644 index 0000000..4165f46 --- /dev/null +++ b/examples/post_hook.pl @@ -0,0 +1,19 @@ +use strict; +use warnings; +use 5.010; +use LWP::UserAgent; +use HTTP::Request::Common; +use YAML qw/LoadFile/; +use JSON; +use File::Spec::Functions; + +my $content = LoadFile(catfile(qw/t data hook_data.yml/)); +my $payload = JSON::encode_json($content); + +my $url = "http://localhost:5000/hook/"; + +my $req = POST $url, [payload => $payload]; + +my $ua = LWP::UserAgent->new(); +my $res = $ua->request($req); +$res->is_success ? say "ok" : say "not ok"; |
