Handle POST requests
(self)
| 82 | self.end_headers() |
| 83 | |
| 84 | def do_POST(self): |
| 85 | """Handle POST requests""" |
| 86 | parsed_path = urlparse(self.path) |
| 87 | |
| 88 | if parsed_path.path == '/chat': |
| 89 | self.handle_chat() |
| 90 | elif parsed_path.path == '/sessions': |
| 91 | self.handle_create_session() |
| 92 | elif parsed_path.path == '/indexes': |
| 93 | self.handle_create_index() |
| 94 | elif parsed_path.path.startswith('/indexes/') and parsed_path.path.endswith('/upload'): |
| 95 | index_id = parsed_path.path.split('/')[-2] |
| 96 | self.handle_index_file_upload(index_id) |
| 97 | elif parsed_path.path.startswith('/indexes/') and parsed_path.path.endswith('/build'): |
| 98 | index_id = parsed_path.path.split('/')[-2] |
| 99 | self.handle_build_index(index_id) |
| 100 | elif parsed_path.path.startswith('/sessions/') and '/indexes/' in parsed_path.path: |
| 101 | parts = parsed_path.path.split('/') |
| 102 | session_id = parts[2] |
| 103 | index_id = parts[4] |
| 104 | self.handle_link_index_to_session(session_id, index_id) |
| 105 | elif parsed_path.path.startswith('/sessions/') and parsed_path.path.endswith('/messages'): |
| 106 | session_id = parsed_path.path.split('/')[-2] |
| 107 | self.handle_session_chat(session_id) |
| 108 | elif parsed_path.path.startswith('/sessions/') and parsed_path.path.endswith('/upload'): |
| 109 | session_id = parsed_path.path.split('/')[-2] |
| 110 | self.handle_file_upload(session_id) |
| 111 | elif parsed_path.path.startswith('/sessions/') and parsed_path.path.endswith('/index'): |
| 112 | session_id = parsed_path.path.split('/')[-2] |
| 113 | self.handle_index_documents(session_id) |
| 114 | elif parsed_path.path.startswith('/sessions/') and parsed_path.path.endswith('/rename'): |
| 115 | session_id = parsed_path.path.split('/')[-2] |
| 116 | self.handle_rename_session(session_id) |
| 117 | else: |
| 118 | self.send_response(404) |
| 119 | self.end_headers() |
| 120 | |
| 121 | def do_DELETE(self): |
| 122 | """Handle DELETE requests""" |
nothing calls this directly
no test coverage detected