Unified logging
This commit is contained in:
		@@ -91,7 +91,7 @@ class MercureHandler
 | 
			
		||||
                    code: RequestException::ERR_INVALID_REQUEST_DATA
 | 
			
		||||
                );
 | 
			
		||||
            [ $name, $value ] = array_map('urldecode', explode("=", $param, 2));
 | 
			
		||||
            if ($name === 'topic') $topics[] = $value;
 | 
			
		||||
            if ($name === 'topic' || $name === 'topic[]') $topics[] = $value;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // Grab the JWT token from the requests authorization attribute
 | 
			
		||||
@@ -142,7 +142,9 @@ class MercureHandler
 | 
			
		||||
 | 
			
		||||
        // Parse out the urlencoded body. Pretty sure there is a better way to do this?
 | 
			
		||||
        $body = explode("&", (string)$request->getBody());
 | 
			
		||||
        $data = [];
 | 
			
		||||
        $data = [
 | 
			
		||||
            'topic' => []
 | 
			
		||||
        ];
 | 
			
		||||
        foreach ($body as $param) {
 | 
			
		||||
            if (!str_contains($param, "="))
 | 
			
		||||
                throw new RequestException(
 | 
			
		||||
@@ -150,10 +152,8 @@ class MercureHandler
 | 
			
		||||
                    code: RequestException::ERR_INVALID_REQUEST_DATA
 | 
			
		||||
                );
 | 
			
		||||
            [ $name, $value ] = array_map('urldecode', explode("=", $param, 2));
 | 
			
		||||
            if (in_array($name, [ 'topic' ])) {
 | 
			
		||||
                if (!isset($data[$name]))
 | 
			
		||||
                    $data[$name] = [];
 | 
			
		||||
                $data[$name][] = $value;
 | 
			
		||||
            if ($name === 'topic' || $name === 'topic[]') {
 | 
			
		||||
                $data['topic'][] = $value;
 | 
			
		||||
            } else {
 | 
			
		||||
                $data[$name] = $value;
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user