I can't get the following Mojo::UserAgent
call to post JSON to the server:
use Mojo::UserAgent;
my $ua=Mojo::UserAgent->new;
my $json = $ua->post("localhost:6767" => {} => json =>{ val=>10 })->res->json;
Using a fake debug server on the other side with nc -l 6767
gives the following output:
POST / HTTP/1.1
User-Agent: Mojolicious (Perl)
Connection: keep-alive
Content-Length: 0
Host: localhost:6767
It's not just the json
method, the form
, and the whole Transactor seems to be broken on 2 of my machines. From the docs:
perl -MMojo::UserAgent::Transactor -E 'say Mojo::UserAgent::Transactor->new->tx(PUT => "http://kraih.com" => json => {a => "b"})->req->to_string;'
PUT / HTTP/1.1
Content-Length: 4
Host: kraih.com
json
Hard to believe my eyes. What am I missing?