cutycat2000x commited on
Commit
88abbff
·
verified ·
1 Parent(s): cfea4a6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -16,13 +16,14 @@ def handle_request(path=""):
16
  data = request.data
17
  params = request.args
18
 
19
- # Make a request to the new URL with the provided method, data, and params
20
- if method == 'GET':
21
- response = requests.get(chat_ui_url, params=params)
22
- elif method == 'POST':
23
- response = requests.post(chat_ui_url, params=params, data=data)
24
- else:
25
- return Response(status=405, response="Method Not Allowed")
 
26
 
27
  # Create a response with the content received from the new URL
28
  proxied_response = Response(response.content)
 
16
  data = request.data
17
  params = request.args
18
 
19
+ headers = None
20
+
21
+ # If the request is a POST request, set the Content-Type header to application/json
22
+ if method == 'POST':
23
+ headers = {'Content-Type': 'application/json'}
24
+
25
+ # Make a request to the new URL with the provided method, data, params, and headers
26
+ response = requests.request(method, chat_ui_url, params=params, data=data, headers=headers)
27
 
28
  # Create a response with the content received from the new URL
29
  proxied_response = Response(response.content)