-
-
Notifications
You must be signed in to change notification settings - Fork 989
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
Beta API: POST /api/apps returns 200 OK on invalid input JSON #3384
Comments
Provide more context please. What is the invalid data you provided to the API? |
Right now, anything. I can't get it to accept any JSON, even if I follow the doc example exactly. For example: {
"name": "Test App",
"output": "",
"cmd": "/path/to/test/app",
"exclude-global-prep-cmd": false,
"elevated": false,
"auto-detach": true,
"wait-all": true,
"exit-timeout": 5,
"prep-cmd": [
],
"detached": [
],
"image-path": "",
} |
Although the bug is not about the invalid data, it's the fact that the API returns 200 OK when it actually is rejecting the input. |
Can you share the full response from the server? Edit: and logs. |
|
Ahhhh... so initially it was failing because of a trailing comma. Now it's failing because of a missing "index" field. |
Logs:
|
Thanks for that extra info. Yea, trailing commas are not valid JSON. I'll update the docs on those. I thought index was no longer required. I'll also look into that. Finally, we certainly shouldn't return a 200 when there's an error. |
Regarding index, I think it is still necessary so that you can edit an app name's name without accidentally creating a new app. |
Yes, that's correct. I discovered that after reviewing the code in more detail, and will improve the documentation around that in the PR linked above. |
Is there an existing issue for this?
Is your issue described in the documentation?
Is your issue present in the latest beta/pre-release?
I'm too lazy to test
Describe the Bug
When using the Beta API, a POST request to /api/apps with invalid input JSON will return a response of 200 OK, with a JSON document that describes the error. It should respond with 400 Bad Request.
Expected Behavior
Invalid POST request to /api/apps should return 400 Bad Request
Additional Context
No response
Host Operating System
Linux
Operating System Version
Linux aizen 6.11.6-zen1-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Fri, 01 Nov 2024 03:30:35 +0000 x86_64 GNU/Linux
Architecture
amd64/x86_64
Sunshine commit or version
0.23.1
Package
Linux - AUR (Third Party)
GPU Type
n/a
GPU Model
n/a
GPU Driver/Mesa Version
n/a
Capture Method
None
Config
No response
Apps
No response
Relevant log output
The text was updated successfully, but these errors were encountered: