Hi guys, I'm new to Dancer2 and I'm trying to access an authorization header, similar to Github's 'X-Hub-Signature'. I consulted with https://metacpan.org/pod/distribution/Dancer2/lib/Dancer2/Manual.pod#header,... says to use 'headers' to "Adds custom headers to responses" and 'header' to "adds a custom header to response", but it does not say how to retrieve the header information, rather than adding it. I'm using starman with nginx as the forward proxy. This is my code for testing header access: post '//hook' => sub { my $hd = header "Content-Type";; "Your Headers: [".$hd."]"; }; When I issue a curl, it returns empty. What am I doing wrong? Feedback welcomed and thanked in advance. Cheers, Vince.
Hi Vince, Try: my $headercontent = request->header('Your-Header-Here'); Kind regards, Lennart On 17-07-15 03:08, Vincent Freeman wrote:
Hi guys,
I'm new to Dancer2 and I'm trying to access an authorization header, similar to Github's 'X-Hub-Signature'.
I consulted with https://metacpan.org/pod/distribution/Dancer2/lib/Dancer2/Manual.pod#header,... says to use 'headers' to "Adds custom headers to responses" and 'header' to "adds a custom header to response", but it does not say how to retrieve the header information, rather than adding it.
I'm using starman with nginx as the forward proxy.
This is my code for testing header access:
post '//hook' => sub { my $hd = header "Content-Type";; "Your Headers: [".$hd."]"; };
When I issue a curl, it returns empty.
What am I doing wrong?
Feedback welcomed and thanked in advance.
Cheers,
Vince. _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
The DSL keywords are much more preferable since that allows us to play more with the internals. We assure the DSL will work, but we do not assure the internal objects will stay the same. In this specific case, I see no reason why "request->headers" won't work forever. It seems like "headers" is only calling "header" again instead of literally calling the "headers". Vincent, would you be able to raise this as a ticket meanwhile so we could address it and you could easily track it? On Fri, Jul 17, 2015 at 9:44 AM, Lennart Hengstmengel <lennart@farenji.net> wrote:
Hi Vince,
Try:
my $headercontent = request->header('Your-Header-Here');
Kind regards, Lennart
On 17-07-15 03:08, Vincent Freeman wrote:
Hi guys,
I'm new to Dancer2 and I'm trying to access an authorization header, similar to Github's 'X-Hub-Signature'.
I consulted with https://metacpan.org/pod/distribution/Dancer2/lib/Dancer2/Manual.pod#header,... says to use 'headers' to "Adds custom headers to responses" and 'header' to "adds a custom header to response", but it does not say how to retrieve the header information, rather than adding it.
I'm using starman with nginx as the forward proxy.
This is my code for testing header access:
post '//hook' => sub { my $hd = header "Content-Type";; "Your Headers: [".$hd."]"; }; When I issue a curl, it returns empty.
What am I doing wrong?
Feedback welcomed and thanked in advance.
Cheers,
Vince. _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
[Comments in-line] ------------------------------------
Date: Sun, 19 Jul 2015 01:35:52 +0200 From: Sawyer X <xsawyerx@gmail.com> To: Perl Dancer users mailing list <dancer-users@dancer.pm> Subject: Re: [dancer-users] Examining incoming POST headers.
The DSL keywords are much more preferable since that allows us to play more with the internals. We assure the DSL will work, but we do not assure the internal objects will stay the same. In this specific case, I see no reason why "request->headers" won't work forever.
Using the DSL is rather nice. ;-)
It seems like "headers" is only calling "header" again instead of literally calling the "headers". Vincent, would you be able to raise this as a ticket meanwhile so we could address it and you could easily track it?
Sure, will do. Thanks, Vince.
On Fri, Jul 17, 2015 at 9:44 AM, Lennart Hengstmengel <lennart@farenji.net> wrote:
Hi Vince,
Try:
my $headercontent = request->header('Your-Header-Here');
Kind regards, Lennart
On 17-07-15 03:08, Vincent Freeman wrote:
Hi guys,
I'm new to Dancer2 and I'm trying to access an authorization header, similar to Github's 'X-Hub-Signature'.
I consulted with https://metacpan.org/pod/distribution/Dancer2/lib/Dancer2/Manual.pod#header,... says to use 'headers' to "Adds custom headers to responses" and 'header' to "adds a custom header to response", but it does not say how to retrieve the header information, rather than adding it.
I'm using starman with nginx as the forward proxy.
This is my code for testing header access:
post '//hook' => sub { my $hd = header "Content-Type";; "Your Headers: [".$hd."]"; }; When I issue a curl, it returns empty.
What am I doing wrong?
Feedback welcomed and thanked in advance.
Cheers,
Vince. _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
On Sat, 18 Jul 2015, Vincent Freeman wrote:
[Comments in-line] ------------------------------------
Date: Sun, 19 Jul 2015 01:35:52 +0200 From: Sawyer X <xsawyerx@gmail.com> To: Perl Dancer users mailing list <dancer-users@dancer.pm> Subject: Re: [dancer-users] Examining incoming POST headers.
Vincent, would you be able to raise this as a ticket meanwhile so we could address it and you could easily track it?
Sure, will do.
Thanks,
Vince.
It seems Sawyer is having trouble with his mail-client. Please close the ticket. -- Henk
On Sun, Jul 19, 2015 at 6:59 AM, Henk van Oers <henk@signature.nl> wrote:
On Sat, 18 Jul 2015, Vincent Freeman wrote:
[Comments in-line]
------------------------------------
Date: Sun, 19 Jul 2015 01:35:52 +0200 From: Sawyer X <xsawyerx@gmail.com> To: Perl Dancer users mailing list <dancer-users@dancer.pm> Subject: Re: [dancer-users] Examining incoming POST headers.
Vincent, would you be able to raise this as a ticket
meanwhile so we could address it and you could easily track it?
Sure, will do.
Thanks,
Vince.
It seems Sawyer is having trouble with his mail-client.
That's a gracious way of saying "Sawyer hadn't noticed someone opened a ticket". :)
On Mon, Jul 20, 2015 at 7:43 AM, Sawyer X <xsawyerx@gmail.com> wrote:
On Sun, Jul 19, 2015 at 6:59 AM, Henk van Oers <henk@signature.nl> wrote:
On Sat, 18 Jul 2015, Vincent Freeman wrote:
[Comments in-line]
------------------------------------
Date: Sun, 19 Jul 2015 01:35:52 +0200 From: Sawyer X <xsawyerx@gmail.com> To: Perl Dancer users mailing list <dancer-users@dancer.pm> Subject: Re: [dancer-users] Examining incoming POST headers.
Vincent, would you be able to raise this as a ticket
meanwhile so we could address it and you could easily track it?
Sure, will do.
Thanks,
Vince.
It seems Sawyer is having trouble with his mail-client.
That's a gracious way of saying "Sawyer hadn't noticed someone opened a ticket". :)
And in case anyone is not sure what Henk is referring to, I'll add a few words: https://github.com/PerlDancer/Dancer2/issues/956 Henk has commented, rightfully, that the "headers" keyword actually refers to setting response headers, not getting the request headers. That's the confusion (even for me, since I don't even remember ever using the "headers" keyword) and that is why this shouldn't be an issue with the keyword. Thanks, Henk! :)
On Thu, Jul 16, 2015 at 9:08 PM, Vincent Freeman <ml@felicis.net> wrote:
Hi guys,
I'm new to Dancer2 and I'm trying to access an authorization header, similar to Github's 'X-Hub-Signature'.
I consulted with https://metacpan.org/pod/distribution/Dancer2/lib/Dancer2/Manual.pod#header,... says to use 'headers' to "Adds custom headers to responses" and 'header' to "adds a custom header to response", but it does not say how to retrieve the header information, rather than adding it.
I'm using starman with nginx as the forward proxy.
This is my code for testing header access:
post '//hook' => sub { my $hd = header "Content-Type";; "Your Headers: [".$hd."]"; };
The header keyword is for setting a header. I think you want: my $hd = request->header('Content-Type'); See: https://metacpan.org/pod/Dancer2::Core::Request -Naveed Massjouni
When I issue a curl, it returns empty.
What am I doing wrong?
Feedback welcomed and thanked in advance.
Cheers,
Vince. _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
participants (5)
-
Henk van Oers -
Lennart Hengstmengel -
Naveed Massjouni -
Sawyer X -
Vincent Freeman