-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
BRP requests without params are rejected, even for paramless methods #23643
Copy link
Copy link
Open
Labels
A-Dev-ToolsTools used to debug Bevy applications.Tools used to debug Bevy applications.C-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesSimple bug fixes and API improvements, docs, test and examplesP-RegressionFunctionality that used to work but no longer does. Add a test for this!Functionality that used to work but no longer does. Add a test for this!S-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!
Description
Bevy version and features
mainat commit53ddd5e615ae15ad796b36724ddd67516bec0c84.- Relevant area:
crates/bevy_remote.
What you did
I sent a BRP request over HTTP to a method that does not need any params, for example rpc.discover (other methods are affected as well), without including a params field:
curl --request POST \
--url http://localhost:15702/ \
--header 'content-type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 0,
"method": "rpc.discover"
}'What went wrong
- Expected: successful response with the method result.
- Actual: error response indicating that the
paramsfield is missing:
{
"jsonrpc": "2.0",
"id": 0,
"error": {
"code": -32600,
"message": "missing field `params`"
}
}This is a regression. The documentation states:
The
paramsfield may be omitted for certain methods.
Additional information
Passing params: null works:
curl --request POST \
--url http://localhost:15702/ \
--header 'content-type: application/json' \
--data '{
"jsonrpc": "2.0",
"id": 0,
"method": "rpc.discover",
"params": null
}'This is likely a result of the recent PR #23175 that introduced a custom (de)serializer for BrpRequest.
let params = params.ok_or_else(|| de::Error::missing_field("params"))?;Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-Dev-ToolsTools used to debug Bevy applications.Tools used to debug Bevy applications.C-BugAn unexpected or incorrect behaviorAn unexpected or incorrect behaviorD-StraightforwardSimple bug fixes and API improvements, docs, test and examplesSimple bug fixes and API improvements, docs, test and examplesP-RegressionFunctionality that used to work but no longer does. Add a test for this!Functionality that used to work but no longer does. Add a test for this!S-Ready-For-ImplementationThis issue is ready for an implementation PR. Go for it!This issue is ready for an implementation PR. Go for it!