Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^3: Perl CGI return 400 Bad request response with JSON content

by Anonymous Monk
on Apr 04, 2022 at 09:14 UTC ( [id://11142659]=note: print w/replies, xml ) Need Help??


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

Your code has syntax errors and does not compile. Please help us help you by making your problem reproducible.

What server are you using to host this service? How is it set up? Which exact response (including all headers) are you receiving in both cases?

  • Comment on Re^3: Perl CGI return 400 Bad request response with JSON content

Replies are listed 'Best First'.
Re^4: Perl CGI return 400 Bad request response with JSON content
by dineshyagappan (Initiate) on Apr 07, 2022 at 10:42 UTC
    it got worked after using below line Apache2::RequestUtil->request->rflush;
      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?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11142659]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-18 00:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found