From f6f163c93580064be3789a98b077ced0376ee954 Mon Sep 17 00:00:00 2001 From: qgarnier Date: Wed, 30 Jun 2021 16:16:36 +0200 Subject: [PATCH] fix(mulesoft): http content type error (#2916) --- apps/mulesoft/restapi/custom/api.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/mulesoft/restapi/custom/api.pm b/apps/mulesoft/restapi/custom/api.pm index c1bc3e1c7..ae900e727 100644 --- a/apps/mulesoft/restapi/custom/api.pm +++ b/apps/mulesoft/restapi/custom/api.pm @@ -123,7 +123,6 @@ sub settings { $self->build_options_for_httplib(); $self->{http}->add_header(key => 'Accept', value => 'application/json'); - $self->{http}->add_header(key => 'Content-Type', value => $options{content_type}); $self->{http}->add_header(key => 'Authorization', value => 'Bearer ' . $self->{access_token}) if (defined($self->{access_token})); $self->{http}->add_header(key => 'X-ANYPNT-ENV-ID', value => $self->{environment_id}) if (defined $options{environment_header}); $self->{http}->add_header(key => 'X-ANYPNT-ORG-ID', value => $self->{organization_id}) if (defined $options{organization_header}); @@ -140,10 +139,11 @@ sub get_access_token { my $login = { username => $self->{api_username}, password => $self->{api_password} }; my $post_json = JSON::XS->new->utf8->encode($login); - $self->settings(content_type => 'application/json'); + $self->settings(); my $content = $self->{http}->request( method => 'POST', + header => ['Content-type: application/json'], query_form_post => $post_json, url_path => $self->{authent_endpoint} ); @@ -183,7 +183,7 @@ sub request_api { $self->{access_token} = $self->get_access_token(statefile => $self->{cache}); } - $self->settings(content_type => 'application/x-www-form-urlencoded', environment_header => 1, organization_header => 1); + $self->settings(environment_header => 1, organization_header => 1); my $content = $self->{http}->request(%options);