From c3ec913000e07899afcb9362bf4f7d49536b5432 Mon Sep 17 00:00:00 2001 From: LangHui He Date: Fri, 12 Nov 2021 22:47:43 -0700 Subject: [PATCH] update chatConversation to POST and README --- README.md | 14 +++++++------- Server/server.py | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b580abe..713f6ff 100644 --- a/README.md +++ b/README.md @@ -39,14 +39,14 @@ APIs list: ## Users related API need login first -- deleteUser (method delete) +- deleteUser (DELETE method) * localhost:8080/users * send URL encoded utf-8 * userID : (userID) --- -- updateUserName (method PUT) +- updateUserName (PUT method) * localhost:8080/users * send: URL encoded utf-8 * userID : (userID) @@ -56,7 +56,7 @@ need login first --- -- updateUserPassword (method PUT) +- updateUserPassword (PUT method) * localhost:8080/users * send: URL encoded utf-8 * userID : (userID) @@ -66,7 +66,7 @@ need login first --- -- auth ( method POST) +- auth (POST method) * localhost:8080/sessions * send: URL encoded utf-8 * userName : (name) @@ -79,7 +79,7 @@ need login first --- -- createUser ( method POST) +- createUser (POST method) * localhost:8080/users * send URL encoded utf-8 * userName : (name) @@ -100,14 +100,14 @@ need login first ## Chat related API - getChatHistory (GET method) -* localhost:8080/chat +* localhost:8080/history * send with URL encoded utf-8 * userID : (userID) * resp: 400(userID can't covert to int or bad or can't find it) 204 (OK but not history found) ---- -- chatConversation (POST method) +- chatConversation (GET method) * localhost:8080/chat * send with URL encoded utf-8 * userID : (userID) diff --git a/Server/server.py b/Server/server.py index 605b392..20e6dfa 100644 --- a/Server/server.py +++ b/Server/server.py @@ -456,8 +456,10 @@ def do_GET(self): if collection == "users": self.getUserS() - elif collection == "chat": + elif collection == "history": self.getChatHistory() + elif self.path == "/chat": + self.chatConversation() elif self.path == "/logout": self.logOut() else: @@ -472,8 +474,6 @@ def do_POST(self): self.handleAuthenticateUser() elif self.path == "/users": self.createUser() - elif self.path == "/chat": - self.chatConversation() else: print("do_POST not found")