Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: HTTP::Tiny losing headers for Stripe

by Anonymous Monk
on Jun 26, 2022 at 11:43 UTC ( [id://11145072]=note: print w/replies, xml ) Need Help??


in reply to HTTP::Tiny losing headers for Stripe

How do you make a copy of $headers?
  • Comment on Re: HTTP::Tiny losing headers for Stripe

Replies are listed 'Best First'.
Re^2: HTTP::Tiny losing headers for Stripe
by Bod (Parson) on Jun 26, 2022 at 12:05 UTC
    How do you make a copy of $headers?

    Simply by assigning it to a new variable and using that...

    my $headers = { 'headers' => { 'Authorization' => 'Bearer ' . $Site::Variables::stripe_secret +, }, 'agent' => 'Wayfinder/v3.0', }; my $head = $headers;

    UPDATE:

    Thinking about it, this only creates a copy of the reference and not a copy of the underlying hash...
    Looks like I need to utilise something like Clone instead.

      just save+restore 'headers' and its value as a ref, this is the only key being deleted, no need to clone. To deal in the longterm perhaps create your own post_form() which will restore the 'headers' key. That HTTP::Tiny behaviour is quite weird. I avoid to mess with user parameters unless i document it.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11145072]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (1)
As of 2024-04-25 19:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found