djangid / rest-assured

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

JSONPath fails to escape URL 127.0.0.1:8080 #190

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Here is a unittest to reproduce the problem:

    @Test
    public void testDotEscapingWithUrlKey() {
        JsonPath path = new JsonPath("{ \"http://127.0.0.1:8080/key\" : \"value\" }");
        assertEquals("value", path.get("http://127.0.0.1:8080/key"));
    }

I am using version 1.6.2
Might be related to this fixed issue: 
http://code.google.com/p/rest-assured/issues/detail?id=172

Original issue reported on code.google.com by JanNiko...@googlemail.com on 22 Aug 2012 at 2:30

GoogleCodeExporter commented 8 years ago
I think you need to escape the path: 

 assertEquals("value", path.get("'http://127.0.0.1:8080/key'")); // Notice the starting and trailing '

Original comment by johan.ha...@gmail.com on 22 Aug 2012 at 5:02

GoogleCodeExporter commented 8 years ago

Original comment by johan.ha...@gmail.com on 24 Aug 2012 at 9:59

GoogleCodeExporter commented 8 years ago
I think this is a valid bug, althoug the provided testcase has error.vI fixed 
the Testcase (added a missingg ") and escaped the url. It is still failing:

    @Test
    public void testDotEscapingWithUrlKey() {
        JsonPath path = new JsonPath("{ \"http://127.0.0.1:8080/key\" : \"value\" }");
        assertEquals("value", path.get("'http://127.0.0.1:8080/key'"));
    }

Original comment by martinEi...@gmail.com on 29 Aug 2012 at 6:08

GoogleCodeExporter commented 8 years ago
I tested this against the current master and it is fixed. I think it was 
related to issue 195.

Original comment by martinEi...@gmail.com on 29 Aug 2012 at 6:32

GoogleCodeExporter commented 8 years ago
Alright great! Thanks for letting us know.

Original comment by johan.ha...@gmail.com on 29 Aug 2012 at 6:58