Skip to content

Commit c7a237f

Browse files
Pass debug mode to JSON formatter for content negotiation in forum
1 parent 6c88823 commit c7a237f

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

framework/core/src/Forum/ForumServiceProvider.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,13 @@ public function register(): void
8282
});
8383

8484
$this->container->bind('flarum.forum.error_handler', function (Container $container) {
85+
$inDebugMode = $container['flarum.config']->inDebugMode();
86+
8587
return new HttpMiddleware\HandleErrors(
8688
$container->make(Registry::class),
8789
new ContentNegotiationFormatter(
88-
$container->make(JsonApiFormatter::class),
89-
$container['flarum.config']->inDebugMode() ? $container->make(WhoopsFormatter::class) : $container->make(ViewFormatter::class),
90+
new JsonApiFormatter($inDebugMode),
91+
$inDebugMode ? $container->make(WhoopsFormatter::class) : $container->make(ViewFormatter::class),
9092
),
9193
$container->tagged(Reporter::class)
9294
);

0 commit comments

Comments
 (0)