in reply to Re^3: Perl CGI return 400 Bad request response with JSON content
in thread Perl CGI return 400 Bad request response with JSON content

it got worked after using below line Apache2::RequestUtil->request->rflush;
  • Comment on Re^4: Perl CGI return 400 Bad request response with JSON content

Replies are listed 'Best First'.
Re^5: Perl CGI return 400 Bad request response with JSON content
by Anonymous Monk on Apr 07, 2022 at 11:07 UTC
    if($validParams) { # ... print $json_output_encoded; # ... } else { # ... Apache2::RequestUtil->request->custom_response(400,$json_output_en +coded);
    Is this a CGI or some mod_perl code? If it's a CGI and you haven't set something up to load Apache2::RequestUtil by default, this could be the reason for the error. What happens if you do the same thing (print $json_output_encoded;) in both your if branches?