diff --git a/lib/NGCP/Panel/Role/Entities.pm b/lib/NGCP/Panel/Role/Entities.pm index 17632b6530..f8eaae5478 100644 --- a/lib/NGCP/Panel/Role/Entities.pm +++ b/lib/NGCP/Panel/Role/Entities.pm @@ -29,9 +29,17 @@ sub auto :Private { sub end :Private { my ($self, $c) = @_; + + if (my $accept = $c->request->header('Accept')) { + if ($accept eq 'application/json') { + $c->response->content_type($accept); + } + } + if ($self->get_config('log_response')) { $self->log_response($c); } + return 1; } diff --git a/lib/NGCP/Panel/Role/EntitiesItem.pm b/lib/NGCP/Panel/Role/EntitiesItem.pm index ca9bbee331..2b50c60a97 100644 --- a/lib/NGCP/Panel/Role/EntitiesItem.pm +++ b/lib/NGCP/Panel/Role/EntitiesItem.pm @@ -34,9 +34,17 @@ sub auto :Private { sub end :Private { my ($self, $c) = @_; + + if (my $accept = $c->request->header('Accept')) { + if ($accept eq 'application/json') { + $c->response->content_type($accept); + } + } + if ($self->get_config('log_response')) { $self->log_response($c); } + return 1; }