Display pretty JSON (#184)

environments/ppa-mbqj77/deployments/1
Clément Oudot 10 years ago
parent d22853d775
commit 895d7f3ef1
  1. 2
      lemonldap-ng-portal/example/openid-configuration.pl
  2. 4
      lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_OpenIDConnect.pm

@ -68,7 +68,7 @@ $configuration->{token_endpoint_auth_methods_supported} =
# $configuration->{op_policy_uri} # $configuration->{op_policy_uri}
# $configuration->{op_tos_uri} # $configuration->{op_tos_uri}
my $json = encode_json $configuration; my $json = to_json( $configuration, { pretty => 1 } );
print $portal->header('application/json; charset=utf-8'); print $portal->header('application/json; charset=utf-8');
print $json; print $json;

@ -923,7 +923,7 @@ sub returnJSONError {
my $content = { "error" => "$error" }; my $content = { "error" => "$error" };
# We use to_json because values are already UTF-8 encoded # We use to_json because values are already UTF-8 encoded
my $json = to_json($content); my $json = to_json( $content, { pretty => 1 } );
# TODO Send 400 return code # TODO Send 400 return code
# CGI always add HTML code to non 200 return code, which is not compatible with JSON response # CGI always add HTML code to non 200 return code, which is not compatible with JSON response
@ -939,7 +939,7 @@ sub returnJSON {
my ( $self, $content ) = splice @_; my ( $self, $content ) = splice @_;
# We use to_json because values are already UTF-8 encoded # We use to_json because values are already UTF-8 encoded
my $json = to_json($content); my $json = to_json( $content, { pretty => 1 } );
$self->lmLog( "Return JSON: $json", 'debug' ); $self->lmLog( "Return JSON: $json", 'debug' );

Loading…
Cancel
Save