Skip Menu |
 

This queue is for tickets about the HTTP-Client CPAN distribution.

Report information
The Basics
Id: 110969
Status: new
Priority: 0/
Queue: HTTP-Client

People
Owner: Nobody in particular
Requestors: kprichard [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: HTTP::Client & request headers
Date: Wed, 6 Jan 2016 19:51:27 -0800
To: bug-HTTP-Client [...] rt.cpan.org
From: kprichard <kprichard [...] gmail.com>
Download (untitled) / with headers
text/plain 1.5k
I'd like to set an outgoing request header on a HTTP::Client instance. The DESCRIPTION claims "It can send HTTP Request headers." I don't see a way to do this, the class doesn't offer a method, and the doc doesn't describe one. So, I tentatively modified HTTP/Client.pm's constructor- sub new { my $class = shift; my $self = {}; $self->{agent} = shift; #user agent $self->{from } = shift; $self->{http } = $http; bless $self, $class; } That adds a http property to HTTP::Client instances, and it has the current HTTP::Lite instance. It's useful, allowing this kind of thing- $client->{http}->add_req_header("Cookie","mycookie=abc"); Which works, right up until the moment we call $client->get(), whereupon this happens- sub get { my $self = shift; ... * $http->reset();* ... } $http->reset() wipes out any fields we might have set previous to the $client->get() call ! Therefore, the change I'm requesting is to- 1. Stop calling $http->reset(), and instead expose a method called reset which would allow callers to indirectly invoke $http->reset() (via $client->reset()) whenever they so desire 2.1 Expose $client->http (as I did above), so that we callers may invoke HTTP::Lite methods, to get at features HTTP::Client doesn't directly offer 2.2 Or, expose an add_req_header, passing it through to $self->{http}->add_req_header But 2.1 is really ideal, so that you the HTTP::Client maintainer don't have to keep adding methods whenever people request them. Kind regards, Kevin Prichard kprichard@gmail.com


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.