salilbc / rest-assured

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

Escaping in json values not present in log output #193

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Ha a service that reurns the following json
{
  "queryString": "(\"Foo\" AND ())"
}
2.enable logging by creating a ResponseSpecification log().status()

What is the expected output? 
I would expect it to log what's actually in the response body and which is 
valid json, i.e:

{
  "queryString": "(\"Foo\" AND ())"
}

What do you see instead?
{
  "queryString": "("Foo" AND ())"
}

What version of the product are you using? 

1.6.2

Original issue reported on code.google.com by m...@farewellutopia.com on 26 Aug 2012 at 3:39

GoogleCodeExporter commented 9 years ago
Correction: the logging should be enabled with log().body() or log().full(), 
not with log().status()

Original comment by m...@farewellutopia.com on 27 Aug 2012 at 4:53

GoogleCodeExporter commented 9 years ago
How does your service return it? As a string? In that case I think it's correct 
since \" will read as " in Java. If you're in doubt check with wireshark and 
see what's actually sent on the wire.

Original comment by johan.ha...@gmail.com on 28 Aug 2012 at 6:34

GoogleCodeExporter commented 9 years ago
The service returns \", the escape is present over the wire as well as when 
directly consumng the body such as with ResponseBody.asString(). Without the 
esacpe it wouldn't be valid json.

Original comment by m...@farewellutopia.com on 28 Aug 2012 at 8:29

GoogleCodeExporter commented 9 years ago
Ok thanks for investigating.

Original comment by johan.ha...@gmail.com on 28 Aug 2012 at 8:53

GoogleCodeExporter commented 9 years ago
Do you know if this issue is still valid?

Original comment by johan.ha...@gmail.com on 4 Jun 2014 at 1:34