salilbc / rest-assured

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

Cannot register custom parser for text/html content type #183

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Implement a service/servlet which will return json string
2. While HTTP response content type is 'text/html'
3. In Rest-assured, call RestAssured.registerParser("text/html", Parser.JSON);

What is the expected output? What do you see instead?
Rest-assured should able to parse http body using JSON parser, while it seems 
still use XML parser.

What version of the product are you using? On what operating system?
Version: 1.6.2
OS: Macos

Please provide any additional information below.

We could not change the content-type to 'text/html' due to some weird reason, 
so it will be great if we could override parser for 'text/html'.

Thanks!

Original issue reported on code.google.com by yydz...@gmail.com on 13 Jul 2012 at 2:49

GoogleCodeExporter commented 9 years ago
That's probably because text/html is already recognized by REST Assured as a 
parser. While it probably should work I don't quite understand why you would 
want to parse HTML using the JSON parser.

Original comment by johan.ha...@gmail.com on 14 Jul 2012 at 6:56

GoogleCodeExporter commented 9 years ago
Yes, this sounds weird, while we could not change the HTTP respond from 
'text/html' to 'text/json', while the actual http body is json string.  So it 
will be great if  RestAssured.registerParser("text/html", Parser.JSON) works 
for this.

thanks.

Original comment by yydz...@gmail.com on 14 Jul 2012 at 8:48

GoogleCodeExporter commented 9 years ago
Fixed in trunk. Please verify.

Original comment by johan.ha...@gmail.com on 16 Aug 2012 at 1:36