mirror of
				https://github.com/veops/cmdb.git
				synced 2025-11-04 13:46:17 +08:00 
			
		
		
		
	fix(api): exception when calling webhook (#516)
This commit is contained in:
		@@ -88,11 +88,11 @@ def webhook_request(webhook, payload):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    params = webhook.get('parameters') or None
 | 
					    params = webhook.get('parameters') or None
 | 
				
			||||||
    if isinstance(params, dict):
 | 
					    if isinstance(params, dict):
 | 
				
			||||||
        params = json.loads(Template(json.dumps(params)).render(payload))
 | 
					        params = json.loads(Template(json.dumps(params)).render(payload).encode('utf-8'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    headers = json.loads(Template(json.dumps(webhook.get('headers') or {})).render(payload))
 | 
					    headers = json.loads(Template(json.dumps(webhook.get('headers') or {})).render(payload))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    data = Template(json.dumps(webhook.get('body', ''))).render(payload)
 | 
					    data = Template(json.dumps(webhook.get('body', ''))).render(payload).encode('utf-8')
 | 
				
			||||||
    auth = _wrap_auth(**webhook.get('authorization', {}))
 | 
					    auth = _wrap_auth(**webhook.get('authorization', {}))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (webhook.get('authorization', {}).get("type") or '').lower() == 'oauth2.0':
 | 
					    if (webhook.get('authorization', {}).get("type") or '').lower() == 'oauth2.0':
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user