Process JSONRPCRequest with default param (#42) #46
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes issue #42 by setting the default to
JSONRPTCRequest.params
from null toEmptyJsonObject
. This makes it so that the absence of params in a request is treated as an empty array which is what the Python sdk also does.Motivation and Context
This makes it so that these two request bodies are treated similarly where previously not including params would result in an empty response.
{"jsonrpc": "2.0", "method": "tools/list","params": {}, "id": 1}
and
{"jsonrpc": "2.0", "method": "tools/list", "id": 1}
How Has This Been Tested?
I tested this with the sample Kotlin server project (with a bit of modification to update sample to use more up to date code) and a basic python SSE client.
I would use the python client to get the sessionId and then I would run
with
"params": {},
I would get the listed tools and without it I would get an empty response(EmptyRequestResult
).I also added a unit test that would fail before my changes (would be EmptyRequestResult) and pass after my changes
Breaking Changes
No
Types of changes
Checklist