Campoie / rest-assured

Automatically exported from code.google.com/p/rest-assured
0 stars 0 forks source link

Problem with single digit string name in Json #150

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create JSON element with element having single digit name, e.g.: 
{"0":"value"}
2. Trying to match it with .body("0", ) fails always.
3. Trying to match it with .body("\"0\"", ) fails sometimes (i think depends on 
groovy version)

What is the expected output? What do you see instead?

should match. According to RFC, name must be string and "0" is a valid string.

What version of the product are you using? On what operating system?

1.4.5, 1.5

Please provide any additional information below.

Would be good if you could add this case to unit tests

Original issue reported on code.google.com by rus...@gmail.com on 24 Jan 2012 at 3:23

GoogleCodeExporter commented 9 years ago
Interesting, I'll try it out when I get the chance. You could also try escaping 
it manually and see if it makes any difference:

.body("'0'", equalTo("value"));

Original comment by johan.ha...@gmail.com on 24 Jan 2012 at 9:01

GoogleCodeExporter commented 9 years ago
I can verify that numbers are not automatically escaped. I've started with 
implementing this. Manual escaping works though:

.body("'0'", equalTo("value"));

Original comment by johan.ha...@gmail.com on 25 Jan 2012 at 9:11

GoogleCodeExporter commented 9 years ago

Original comment by johan.ha...@gmail.com on 25 Jan 2012 at 12:40