public static function ensureJsonSuffix(): callable
    {
        return function (callable $handler) {
            return function (RequestInterface $request, array $options = null) use ($handler) {
                $uri = $request->getUri();
                $path = $uri->getPath();

                if (substr($path, -5) !== '.json') {
                    $uri = $uri->withPath($path.'.json');
                    $request = $request->withUri($uri);
                }

                return $handler($request, $options ?? []);
            };
        };
    }
public static function ensureJsonSuffix(): callable
    {
        return function (callable $handler) {
            return function (RequestInterface $request, array $options = null) use ($handler) {
                $uri = $request->getUri();
                $path = $uri->getPath();

                if (substr($path, -5) !== '.json') {
                    $uri = $uri->withPath($path.'.json');
                    $request = $request->withUri($uri);
                }

                return $handler($request, $options ?? []);
            };
        };
    }
public static function ensureJsonSuffix ( ) : callable { return function ( callable $ handler ) { return function ( RequestInterface $ request , array $ options = null ) use ( $ handler ) { $ uri = $ request -> getUri ( ) ; $ path = $ uri -> getPath ( ) ; if ( substr ( $ path , - 5 ) !== '.json' ) { $ uri = $ uri -> withPath ( $ path . '.json' ) ; $ request = $ request -> withUri ( $ uri ) ; } return $ handler ( $ request , $ options ?? [ ] ) ; } ; } ; }
Ensures that the ".json" suffix is added to URIs and that the content type is set correctly.

@return callable
Ensures that the . json suffix is added to URIs and that the content type is set correctly .