From b712de8438b94a9cc2b43904f2a3a35dce3e7870 Mon Sep 17 00:00:00 2001 From: Gerhard Jungwirth Date: Fri, 29 Jun 2018 17:23:47 +0200 Subject: [PATCH] TT#40540 fix Accept Header treatment the accept header can contain a list of comma-separated values. If only one of those is application/json or */*, we should send that. Example of an Accept header: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Change-Id: I45bdea5dca05060c1cc17ce5bbdff9c58cb5ca72 --- lib/NGCP/Panel/Role/EntitiesItem.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/NGCP/Panel/Role/EntitiesItem.pm b/lib/NGCP/Panel/Role/EntitiesItem.pm index 40c45dd5db..3cda88793d 100644 --- a/lib/NGCP/Panel/Role/EntitiesItem.pm +++ b/lib/NGCP/Panel/Role/EntitiesItem.pm @@ -189,14 +189,14 @@ sub get { my $action_config = $self->get_config('action'); if( ( defined $header_accept - && ($header_accept ne 'application/json') - && ($header_accept ne '*/*') + && ($header_accept !~ m!\bapplication/json\b|\b\*/\*\b!) # application/json OR */* ) || ( $action_config->{GET}->{ReturnContentType} && $action_config->{GET}->{ReturnContentType} ne 'application/json' ) ) { $self->return_requested_type($c,$id,$item); + # in case this method is not defined, we should return a reasonable error explaining the Accept Header return; }