http://www.perlmonks.org?node_id=11131470


in reply to Re: Injecting a value into HTTP::Header
in thread Injecting a value into HTTP::Header

Hi, "not managing to get the injection to work" doesn't really describe the problem well

Sorry - yes, re-reading my question shows it is not very clear.

What I meant was that injecting the token_type parameter is not working. My sub doesn't throw an error but causes the super class sub to throw an error that token_type is missing.

push_header() since that does not appear as a documented method on an HTTP::Response object

HTTP::Response extends HTTP::Message which requires's HTTP::Headers and push_header() is a method of this class.

Although looking at the link you provided sparked the realisation that token_type is not a header at all. It needs to be added to the content rather than the header. So I think I am going to have to decode the JSON content to a Perl data structure, add the token_type parameter before encoding it back to JSON and passing that to the super class' sub.

I can see running into propblems with the encoding as there doesn't appear to be a way to reverse the effects of decoded_content