Add missing require#11
Merged
atesgoral merged 1 commit intoShopify:mainfrom Jun 16, 2025
Merged
Conversation
This gem uses `json`, but does not `require` it now. This PR adds it.
In the test, `simplecov` loads `json`. So it was passed. If we
comment out `simplecov`, the test would fail like the following.
```
1) Error:
JsonRpcHandler::#handle#test_0016_returns an error with the code set to -32700 there is a JSON parse error:
NameError: uninitialized constant JsonRpcHandler::JSON
lib/json_rpc_handler.rb:54:in 'JsonRpcHandler.handle_json'
test/json_rpc_handler_test.rb:472:in 'handle_json'
test/json_rpc_handler_test.rb:284:in 'block (3 levels) in <top (required)>'
2) Error:
JsonRpcHandler::#handle_json#test_0002_returns nil for notifications:
NoMethodError: undefined method 'to_json' for an instance of Hash
test/json_rpc_handler_test.rb:449:in 'block (3 levels) in <top (required)>'
3) Error:
JsonRpcHandler::#handle_json#test_0001_returns a Response object when the request is valid and not a notification:
NoMethodError: undefined method 'to_json' for an instance of Hash
test/json_rpc_handler_test.rb:441:in 'block (3 levels) in <top (required)>'
4) Error:
JsonRpcHandler::#handle_json#test_0003_returns an error with the id set to nil when the request is invalid:
NoMethodError: undefined method 'to_json' for an instance of Hash
test/json_rpc_handler_test.rb:455:in 'block (3 levels) in <top (required)>'
```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This gem uses
json, but does notrequireit now. This PR adds it.In the test,
simplecovloadsjson. So it was passed. If we comment outsimplecov, the test would fail like the following.