-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow setting LWP::UserAgent options #25
Comments
I just pushed a change to the iss25 branch that should address this, but i don't currently really have any way of testing it, so it's kind of a shot in the dark.... |
I've pushed 3f40a5d to branch iss25 change that should work. The #!/usr/bin/env perl
use strict;
use warnings;
use lib "Zabbix::Tiny/lib/"; ##Set path as appropriate.
use Zabbix::Tiny;
use Data::Printer;
my $zabbix = Zabbix::Tiny->new(
server => 'https://zabbix.domain.com.com/api_jsonrpc.php',
password => 'password',
user => 'username',
lwp_attrs => {
default_headers => HTTP::Headers->new(
'x-my-header' => 'some value here'
),
},
);
my $hosts = $zabbix->do(
'host.get', {
output => [qw(hostid name host)],
monitored_hosts => 1,
limit => 1,
}
);
p $hosts; I'm considering just adding an 'http_headers' value that can be set in Zabbix::Tiny's lwp_attrs => {
default_headers => HTTP::Headers->new(
'x-my-header' => 'some value here'
),
} To this: http_headers => {
'x-my-header' => 'some value here'
}, Either way, the Let me know if the sample code works for you, and if so, i'll begin on the documentation (and...unit tests? maybe?) |
@richlv noted he was having trouble with requests being rejected due to mod-security, and not having an Allow header set.
I think it should be pretty easy to address this by adding an attribute for UA arguments, and then passing those args to the UA instantiation.
The text was updated successfully, but these errors were encountered: