X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FResponse.pm;h=74d59fe87b7e719469646624c8a1ff151c347f45;hp=a3580ffca94d19818580cf56195811b93c6f0082;hb=67fd25bc03bc87a19db237a13fcb1cd157252101;hpb=51b34249806efbb5eb2572baf32ebaf619840d17 diff --git a/lib/Catalyst/Response.pm b/lib/Catalyst/Response.pm index a3580ff..74d59fe 100644 --- a/lib/Catalyst/Response.pm +++ b/lib/Catalyst/Response.pm @@ -148,7 +148,10 @@ sub from_psgi_response { my ($status, $headers, $body) = @$psgi_res; $self->status($status); $self->headers(HTTP::Headers->new(@$headers)); - $self->body(join('', @$body)); + # Can be arrayref or filehandle... + if(defined $body) { # probably paranoia + ref $body eq 'ARRAY' ? $self->body(join('', @$body)) : $self->body($body); + } } elsif(ref $psgi_res eq 'CODE') { $psgi_res->(sub { my $response = shift; @@ -156,7 +159,8 @@ sub from_psgi_response { $self->status($status); $self->headers(HTTP::Headers->new(@$headers)); if(defined $maybe_body) { - $self->body(join('', @$maybe_body)); + # Can be arrayref or filehandle... + ref $maybe_body eq 'ARRAY' ? $self->body(join('', @$maybe_body)) : $self->body($maybe_body); } else { return $self->write_fh; } @@ -551,7 +555,13 @@ Example: } Please note this does not attempt to map or nest your PSGI application under -the Controller and Action namespace or path. +the Controller and Action namespace or path. You may wish to review 'PSGI Helpers' +under L for help in properly nesting applications. + +B If your external PSGI application returns a response that has a character +set associated with the content type (such as "text/html; charset=UTF-8") we set +$c->clear_encoding to remove any additional content type encoding processing later +in the application (this is done to avoid double encoding issues). =head2 encodable_content_type