Hello collegues,
I need to check my API from command line, but I haven't found any manual
how to do it correctly. Let me explain problem on example:
I have POST handler:
#!/usr/bin/env perl
use Mojolicious::Lite;
post '/' => sub {
my $self = shift;
warn $self->param("email");
...
# warn $something_else
$self->render({text => 'OK'});
};
And I need to check correcthess of parameters processing. In this simple
example task is just output in console value of email parameter like GET
way:
./api.pl get /?email='[email protected]'
And how to do it with POST requests?
In help file there is only one example with POST:
mojo get -M POST -c 'trololo' mojolicio.us
And usage is: APPLICATION get [OPTIONS] URL [SELECTOR|JSON-POINTER] [COMMANDS]
Options:
-C, --charset <charset> Charset of HTML/XML content, defaults to auto
detection.
-c, --content <content> Content to send with request.
-H, --header <name:value> Additional HTTP header.
-M, --method <method> HTTP method to use, defaults to "GET".
-r, --redirect Follow up to 10 redirects.
-v, --verbose Print request and response headers to STDERR.
But how to be if after -c key not a simple string like "trololo", but there are
some parameters?
I tried this way:
./api.pl get -M POST -c 'email=test@test' /
./api.pl get -M POST -c '{email=>test@test}' /
But both of them doesn't work.
Any suggestion is much appreciated.
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.