[dancer-users] status issue

Chad Wallace cwallace at lodgingcompany.com
Thu Feb 27 17:10:13 GMT 2020


On Thu, 27 Feb 2020 15:48:34 +0000
Lyn St George <lyn at zolotek.net> wrote:

> On Wed, 26 Feb 2020 11:31:57 -0800
> Chad Wallace <cwallace at lodgingcompany.com> wrote:
> 
> > On Wed, 26 Feb 2020 13:25:33 +0000
> > Lyn St George <lyn at zolotek.net> wrote:
> >   
> > > Trying to send a 'status 200' back to Stripe from a webhook, using
> > > D2 0.30000, perl 5.30.0 on Gentoo.
> > > 
> > > Using either:
> > > 	status 200
> > > 	Dancer2::Core::HTTP->status(200); 
> > >  	$self->app->response->status( '200' );
> > > or indeed nothing (as D2 apparently sends a status anyway),
> > > the result is:    
> > 
> > Have you tried just returning your content?  That would give a 200
> > status.  If you want no content, you should be able to return the
> > empty string:
> > 
> >     return '';  
> 
> 
> 
> Thanks Chad
> I need to parse the content after the status response. Given that D2
> sends a status anyway without being explicitly told to, this looks
> more like a bug.

Normally (with all web frameworks, not just Dancer) the request handler
returns a status when it's finished.  The status code, headers, and
content make up the response, which is the output of the request
handler back to the user agent (which initiated the request).  If
something else were to be done with the content afterwards, it would be
done either in the user agent or in a subsequent request sent by the
user agent.

Maybe you should explain more about what you're doing and why.  I don't
know anything about Stripe, but maybe you need to add another type of
hook in Stripe that does something with the response content after it
comes back from the webhook.


> > > Route exception: Undef did not pass type constraint "Num" (in
> > > $self->{"status"})
> > > at /usr/local/lib64/perl5/5.30.0/Dancer2/Core/DSL.pm line 279
> > > "Num" is a subtype of "LaxNum" "LaxNum" is a subtype of "Str"
> > > "Str" is a subtype of "Value" "Value" is a subtype of "Defined"
> > >     Undef did not pass type constraint "Defined" (in
> > > $self->{"status"}) "Defined" is defined as: (defined($_))
> > > in /usr/local/lib64/perl5/5.30.0/Dancer2/Core/App.pm l. 1488    
> >   
> 
> _______________________________________________
> dancer-users mailing list
> dancer-users at dancer.pm
> http://lists.preshweb.co.uk/mailman/listinfo/dancer-users


-- 

C. Chad Wallace, B.Sc.
The Lodging Company
http://www.lodgingcompany.com/
OpenPGP Public Key ID: 0x262208A0
+1 250-869-4931 ext. 6251


More information about the dancer-users mailing list