Thread HTTP::Request::Common verallgemeinern
(5 answers)
Opened by Andi123 at 2017-08-03 16:30
Hm, ich hatte das so verstanden, dass ich mit HTTP::Request::Common keine Header setzen kann, da Standardheader voreingestellt sind.
Gesetzt werden muss all das hier: Code (perl): (dl
)
1 2 3 $request->content_type('application/json; charset=utf-8'); $request->header(accept => 'application/json'); $request->authorization_basic($acountUsername, $acountPassword); Komplett sieht das, was ich mit HTTP::REQUEST aufrufe, so aus Code (perl): (dl
)
1 2 3 4 5 my $request = HTTP::Request->new(POST => $url); $request->content_type('application/json; charset=utf-8'); $request->header(accept => 'application/json'); $request->authorization_basic($acountUsername, $acountPassword); $request->content(JSON->new->encode(%content)); Last edited: 2017-08-04 11:14:46 +0200 (CEST) |