Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small issues #52

Open
sehraf opened this issue May 26, 2022 · 1 comment
Open

Small issues #52

sehraf opened this issue May 26, 2022 · 1 comment

Comments

@sehraf
Copy link

sehraf commented May 26, 2022

I've encountered a few issues whhile working on rustyshare:

  • the content type of REST request is not application/json
  • the code for sending a chat message is using rsmsgs as URL (which should be rsMsgs)

Here is a patch

diff --git a/webui-src/app/chat/chat.js b/webui-src/app/chat/chat.js
index aab96e9..39564cf 100644
--- a/webui-src/app/chat/chat.js
+++ b/webui-src/app/chat/chat.js
@@ -212,7 +212,7 @@ const ChatLobbyModel = {
   },
   sendMessage(msg, onsuccess) {
     rs.rsJsonApiRequest(
-      '/rsmsgs/sendChat',
+      '/rsMsgs/sendChat',
       {},
       () => {
         // adding own message to log
diff --git a/webui-src/app/rswebui.js b/webui-src/app/rswebui.js
index 773b297..3505985 100644
--- a/webui-src/app/rswebui.js
+++ b/webui-src/app/rswebui.js
@@ -28,6 +28,7 @@ function rsJsonApiRequest(
   config = null
 ) {
   headers['Accept'] = 'application/json';
+  headers['content-type'] = 'application/json';
   if (loginKey.isVerified) {
     headers['Authorization'] = 'Basic ' + btoa(loginKey.username + ':' + loginKey.passwd);
   }
@zelfroster
Copy link
Contributor

zelfroster commented Jul 13, 2023

This issue can be closed, as I checked that sending requests even with different case seems to work without any issue, for e.g rsfiles/rsFiles both work.
And for the 2nd issue, we don't need to mention content-type unless the request is of PUT or POST type. I read this on this Stack Overflow thread https://stackoverflow.com/a/16693884/16184838

So, I guess we can close this issue @csoler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants