summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2017-12-17 07:52:48 +0100
committerYorhel <git@yorhel.nl>2017-12-17 07:52:50 +0100
commit2ac1a9af38625bfab9cf144c947cb1a1225b7d0d (patch)
tree919c0b75934a8b424607abb297cadfdea1213aca
parent24529acdb4aca29e47ae5c0decfec337da79d4b5 (diff)
Don't call resInit from resJSON
For the same reason that I removed the resInit call from resRedirect.
-rw-r--r--lib/TUWF/Response.pm4
-rw-r--r--lib/TUWF/Response.pod3
2 files changed, 2 insertions, 5 deletions
diff --git a/lib/TUWF/Response.pm b/lib/TUWF/Response.pm
index bef3648..aa78efb 100644
--- a/lib/TUWF/Response.pm
+++ b/lib/TUWF/Response.pm
@@ -190,8 +190,8 @@ sub resJSON {
croak "Unable to load JSON::XS, is it installed?\n"
unless eval { require JSON::XS; 1 };
- $self->resInit;
- $self->resHeader('Content-Type' => 'application/json');
+ $self->resHeader('Content-Type' => 'application/json; charset=UTF-8');
+ $self->resBuffer('clear');
my $fd = $self->resFd();
print $fd JSON::XS::encode_json($obj);
}
diff --git a/lib/TUWF/Response.pod b/lib/TUWF/Response.pod
index 55bf14d..20d8261 100644
--- a/lib/TUWF/Response.pod
+++ b/lib/TUWF/Response.pod
@@ -178,9 +178,6 @@ you had to set these B<after> calling C<resRedirect()>. In TUWF versions after
Sets the content type to C<application/json> and sends the encoded JSON object
to the client.
-C<resJSON()> calls C<resInit()>, so if you wish to send any additional headers
-or cookies, you have to set these B<after> calling C<resJSON()>.
-
=head2 resBinary(data)
Send binary data to the client. This method throws away any data currently