in reply to Re: json Array with URI
in thread json Array with URI

In your server code you have the following line:

print "Content-type: application/json;\n\n";

What is that line doing there and are you certain that the rest of the script hasn't already sent complete headers? This would easily explain why $response->decoded_content starts with Content-type:.

Update: And indeed, in your server code, you have print $q->header;. Printing more headers after that will not add those lines to the headers but to the reply body. See the ->content_type method of CGI.

This also makes your diagnosis of

My response $json_text (an array with a list of URI) looks like this:
somewhat suspect because there must (or rather, should) be a line Content-type: application/json; right before that.

Replies are listed 'Best First'.
Re^3: json Array with URI
by IB2017 (Pilgrim) on Dec 27, 2018 at 15:21 UTC

    Now I see. You are right. I was printing twice the header. I know it was something stupid somewhere. Thank you very much for opening my eyes.