Dispatcher sets content type on Handler::File miss #551

Closed
veryrusty opened this Issue Mar 28, 2014 · 2 comments

Projects

None yet

2 participants

@veryrusty
PerlDancer member

From @racke in #545

So while working on the autopage.t we discovered another bug in the
Dancer2 code (lib/Dancer2/Handler/File.pm). The content type is never
set as there is a value present in the header already.

My understanding of the existing logic was that a before hook (as an example) was allowed to set a content type and Handler::File wouldn't override it.

Note that for both subtests in t/handler_file.t, Handler::File is being called twice. The first time as a route_handler (get '/**'), the second time from send_file. The Dispatcher sets the content type after the first call (within _dispatch_route ).

@xsawyerx
PerlDancer member

Duplicate of #550.

@xsawyerx xsawyerx closed this Mar 28, 2014
@xsawyerx
PerlDancer member

Fixed by fa27fec.

@veryrusty veryrusty added a commit that referenced this issue Mar 29, 2014
@veryrusty veryrusty Remove default_content_type attribute to the Response object.
Moves the logic of what content type to apply by 'default' into the
Response object, resulting in much simplier logic within _dispatch_route.

Big win is that the default content type is not applied until it is actually
required. Ref #550 and #551.
08de179
@veryrusty veryrusty added a commit that referenced this issue Apr 2, 2014
@veryrusty veryrusty Remove default_content_type attribute to the Response object.
Moves the logic of what content type to apply by 'default' into the
Response object, resulting in much simplier logic within _dispatch_route.

Big win is that the default content type is not applied until it is actually
required. Ref #550 and #551.
163c4ef
@veryrusty veryrusty added a commit that referenced this issue May 24, 2014
@veryrusty veryrusty Remove default_content_type attribute to the Response object.
Moves the logic of what content type to apply by 'default' into the
Response object, resulting in much simplier logic within _dispatch_route.

Big win is that the default content type is not applied until it is actually
required. Ref #550 and #551.
e2b5437
@veryrusty veryrusty added a commit that referenced this issue Jun 19, 2014
@veryrusty veryrusty Remove default_content_type attribute to the Response object.
Moves the logic of what content type to apply by 'default' into the
Response object, resulting in much simplier logic within _dispatch_route.

Big win is that the default content type is not applied until it is actually
required. Ref #550 and #551.
3b89be0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment