fix endless parsing

This commit is contained in:
a10zn8
2024-03-01 12:48:45 +03:00
parent 10cbb999eb
commit 3c475c63cd
2 changed files with 35 additions and 12 deletions

View File

@@ -223,4 +223,16 @@ class ResponseRpcParserSpec extends Specification {
!act.hasResult()
}
def "Parse non object error"() {
setup:
def json = '{"jsonrpc": "2.0", "id": 1, "error": "plain error"}'
when:
def act = parser.parse(json.getBytes())
then:
act.error != null
act.error.message == "plain error"
act.hasError()
!act.hasResult()
}
}