treviettreviet / chrome-rest-client

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

JSON parsed output contains "null" #96

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Hit a resource that returns the following JSON response body:

  {"companies":"http://localhost:8080/companies/"}

2. The "parsed" format will display as:

  null{"companies":"http://localhost:8080/companies/"}

3. I am expecting the output to display as:

  {
    "companies": "http://localhost:8080/companies/"
  }

instead. 

The "null" is a serious bug in that it indicates the response contains some 
text which it does not.

The newlines and pretty print are icing on the cake (though highly recommended).

Original issue reported on code.google.com by cow...@bbs.darktech.org on 8 Nov 2012 at 3:13

GoogleCodeExporter commented 9 years ago
Small correction. In step 3, the value should read 
"http://localhost:8080/companies/" (notice the closing quotes were added).

Original comment by cow...@bbs.darktech.org on 8 Nov 2012 at 3:14

GoogleCodeExporter commented 9 years ago
Either way the null should not be there. It should be corrected in next update 
(probably next week)

Original comment by jarro...@gmail.com on 8 Nov 2012 at 12:23

GoogleCodeExporter commented 9 years ago
whatever I do I can't reproduce a problem. What is the final response? I meant 
headers and payload. Maybe this will help me to find a problem.

Original comment by jarro...@gmail.com on 8 Nov 2012 at 7:34

GoogleCodeExporter commented 9 years ago
Here is what I get. Let me know what else I can do to help:

Status: 200 OK
Loading time: 9

Request headers

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like 
Gecko) Chrome/23.0.1271.64 Safari/537.11
Content-Type: text/plain; charset=utf-8 
Accept: */*
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

Response headers

Content-Type: application/x-custom+json; version=1 
Transfer-Encoding: chunked 
Server: Jetty(8.1.7.v20120910)

Original comment by cow...@bbs.darktech.org on 9 Nov 2012 at 2:45

GoogleCodeExporter commented 9 years ago
It's clear now.
The "application/x-custom+json; version=1" content type header is not 
recognized by the app as a JSON response and it try to parse it as a regular 
HTML file. There is a bug (I trying to find it) which inserts NULL in the begin 
of the response payload.
In app there is no more option to set-up custom json headers. All valid 
(according to spec) headers are recognized by the app.
Anyway, I will try to eliminate NULL in parsed response view.

Original comment by jarro...@gmail.com on 9 Nov 2012 at 7:46

GoogleCodeExporter commented 9 years ago
+json is legal according to this draft specification: http://json-schema.org/

Original comment by cow...@bbs.darktech.org on 9 Nov 2012 at 7:52

GoogleCodeExporter commented 9 years ago
I believe RFC says something different: http://www.ietf.org/rfc/rfc4627.txt
According to this, the only valid MIME type for json is application/json. 
However, purpose of this application is to help developers to develop so I'm 
happy to add more definitions (or patterns). 

Original comment by jarro...@gmail.com on 9 Nov 2012 at 8:01

GoogleCodeExporter commented 9 years ago

Original comment by jarro...@gmail.com on 19 Jan 2013 at 10:46