hi,
your code works for me with Mojolicious 8.12 -- i got the expected response 
back from postman-echo.com:

{
  "args": {},
  "data": "",
  "files": {},
  "form": {
    "code": "whatever",
    "grant_type": "authorization_code",
    "xxx": "777"
  },
  "headers": {
    "x-forwarded-proto": "https",
    "x-forwarded-port": "443",
    "host": "postman-echo.com",
    "x-amzn-trace-id": "Root=1-653e7226-05cb12432a6ed6e652b6afe2",
    "content-length": "51",
    "user-agent": "Mojolicious (Perl)",
    "authorization": "Basic xxxxxxxxxxxxxx",
    "accept-encoding": "gzip",
    "content-type": "application/x-www-form-urlencoded"
  },
  "json": {
    "code": "whatever",
    "grant_type": "authorization_code",
    "xxx": "777"
  },
  "url": "https://postman-echo.com/post";
}';

maybe you are using a VERY old version of Mojo::UserAgent that has the 
post_form( $url => $data) method?
jay

On Friday, October 27, 2023 at 5:15:52 PM UTC-4 yuichi....@gmail.com wrote:

> I tried below code. But the request body are missing.
>
> my $ua = Mojo::UserAgent->new;
>
> my $url = "https://postman-echo.com/post";;
>
> my $tx = $ua->post(
>
>     $url => {
>
>         'Authorization' => 'Basic xxxxxxxxxxxxxx',
>
>         'Content-Type' => 'application/x-www-form-urlencoded'
>
>     } => form => {
>
>         'grant_type' => 'authorization_code',
>
>         'code' => $code,
>
>         'xxx' => '777'
>
>     }
>
> );
>
>
> Here is a result. I expected value at "form" variables.
>
> '{
>
> "args": {},
>
> "data": "",
>
> "files": {},
>
> "form": {},
>
> "headers": {
>
> "x-forwarded-proto": "https",
>
> "x-forwarded-port": "443",
>
> "host": "postman-echo.com",
>
> "x-amzn-trace-id": "Root=1-653c253d-2bee01d92fa16ed279d4b219",
>
> "content-type": "application/x-www-form-urlencoded",
>
> "authorization": "Basic xxxxxxxxxxxxxx"
>
> },
>
> "json": null,
>
> "url": "https://postman-echo.com/post";
>
> }';
>
>
> Anyone know the reason?
>
>
>
> With regards,
>
>
>

-- 
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 mojolicious+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mojolicious/2b9ec768-7d45-4342-ab85-abf16bf771d0n%40googlegroups.com.

Reply via email to