As per my comment on StackOverflow, this:
wrap => sub {
my ( $req ) = @_;
# $req->{headers}->{'TE'} = 'ASAD';
return $req;
},
wrap => \&HTTP::Request::Generator::as_http_request,
Does not work. The wrap option can only be given once. The second wrapper (\&HTTP::Request::Generator::as_http_request) overrides the first one (sub {...}) and the first one is completely being ignored so it doesn't need to be there.
I'm not sure why you're using HTTP::Request::Generator at all. LWP::UserAgent (perhaps with a cookie jar) seems like it should do all you need.