JoergReinhardt / gorilla

Automatically exported from code.google.com/p/gorilla
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

[json] Error message not returned #49

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the following program: http://play.golang.org/p/4mXIb2sWZV
2. telnet to the server and send the following request
POST /_rpc HTTP/1.1
Content-Encoding: identity
Content-Length: 67
Content-Type: application/json
Host: localhost

{"id":"foobar","method":"HelloService.Say","params":["123456789"]}

What is the expected output? 
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Mon, 06 Aug 2012 21:25:57 GMT
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff

29
{"result":null,"error":"this is an error","id":"foobar"}

0

What do you see instead?
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Mon, 06 Aug 2012 21:25:57 GMT
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff

29
{"result":null,"error":{},"id":"foobar"}

0

Please provide any additional information below.
Running against the latest version of gorilla json.

Original issue reported on code.google.com by alexan...@mosoi.ro on 6 Aug 2012 at 9:32

GoogleCodeExporter commented 9 years ago
Could you please post the source of this example?

Original comment by rodrigo.moraes on 7 Aug 2012 at 12:58

GoogleCodeExporter commented 9 years ago
hi,

for a fix and a testsuite update please see the attached patch.

(i reconstructed the testing a bit, to avoid copy-n-paste of the testing code)

hope that helps!

cheers,
chressie

Original comment by chressie on 29 Aug 2012 at 10:03

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 7d3df2811499.

Original comment by rodrigo.moraes on 29 Aug 2012 at 5:11