Skip to content

Instantly share code, notes, and snippets.

@FCO
Created February 18, 2020 00:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FCO/b5ff6f7470ecc127fb988c2dbe00a4ef to your computer and use it in GitHub Desktop.
Save FCO/b5ff6f7470ecc127fb988c2dbe00a4ef to your computer and use it in GitHub Desktop.
EEL
event login {
has $session-id = #post.req-id;
has $timestamp = #post.timestamp;
match {
request(#get , method == "GET" , path == "/login", status == 200)
request(#post, method == "POST", path == "/login", status == 200, req-id == #get.req-id)
}
}
raku -I. -MEEL -e '
my Supplier $supplier .= new;
eel($supplier.Supply, :code("examples/login")).tap: *.say;
$supplier.emit: %( :type<request>, :method<GET> , :path</>, :req-id<aaaa1111>, :status(200) );
$supplier.emit: %( :type<request>, :method<GET> , :path</>, :req-id<aaaa2222>, :status(200) );
$supplier.emit: %( :type<request>, :method<GET> , :path</login>, :req-id<1234abcd>, :status(200) );
$supplier.emit: %( :type<request>, :method<GET> , :path</>, :req-id<aaaa3333>, :status(200) );
$supplier.emit: %( :type<request>, :method<GET> , :path</login>, :req-id<4321xyzz>, :status(200) );
$supplier.emit: %( :type<request>, :method<POST>, :path</login>, :req-id<1234abcd>, :status(200), :session-id<abc123> );
'
{session-id => abc123, timestamp => Instant:1581984202.052599, type => login}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment