[英]Read json returned by 400 error clojure
I have a web-service that reply at some get request, something like this: http://developer.echonest.com/api/v4/artist/reviews?api_key=N6E4NIOVYMTHNDM8J&id=ARH6W4X1187B99274F&format=json&results=1&start=2 if a parameter in the request is wrong: http://developer.echonest.com/api/v4/artist/reviews?api_key=N6E4NIOVYMTHNDM8J&id=ARH6W4X1187B99274F&format=json&results=1&start=WRONG-STRING the server reply with a 400 and some json explain what is went wrong. 我有一个Web服务,该服务会在收到某些请求时进行答复,例如: http : //developer.echonest.com/api/v4/artist/reviews?api_key=N6E4NIOVYMTHNDM8J&id=ARH6W4X1187B99274F&format=json&results=1&start=2(如果其中有一个参数)该请求是错误的: http : //developer.echonest.com/api/v4/artist/reviews? api_key=N6E4NIOVYMTHNDM8J&id=ARH6W4X1187B99274F&format=json&results=1&start=WRONG-STRING服务器回复并显示400和一些json,解释出问题了。
Now in clojure I want to read the json to know exactly what is went wrong, i tried with (clojure.java.io/reader wrong-url) but it thrown an exception 现在在clojure中,我想读取json以确切知道出了什么问题,我尝试了(clojure.java.io/reader错误URL),但它引发了异常
Server returned HTTP response code: 400 for URL: 服务器返回URL的HTTP响应代码:400:
http://developer.echonest.com/api/v4/artist/reviews ? http://developer.echonest.com/api/v4/artist/reviews ? api_key=N6E4NIOVYMTHNDM8J&id=ARH6W4X1187B99274F&format=json&results=1&start=e1 [Thrown class java.io.IOException] api_key = N6E4NIOVYMTHNDM8J&id = ARH6W4X1187B99274F&format = json&results = 1&start = e1 [引发类java.io.IOException]
How can i read the json ? 我如何阅读json?
Sometimes I just really want to see what's going over the wire, and in those situations I fire up Wireshark , a network packet analyser. 有时,我只是真的很想看看网络上发生了什么,在这种情况下,我启动了Wireshark (网络数据包分析器)。 Here's how I'd use it in this case (but it's a powerful and flexible piece of software, you can do lots of nifty stuff with it): 这是在这种情况下的用法(但这是一款功能强大且灵活的软件,您可以用它做很多漂亮的事情):
host developer.echonest.com
as the capture filter 输入host developer.echonest.com
作为捕获过滤器 Then interact with your service at echonest.com - you'll see packets coming in in Wireshark's window. 然后在echonest.com与您的服务进行交互-您将在Wireshark的窗口中看到数据包进入。 When you're done, go back to Wireshark and hit Capture->Stop (Ctrl-E). 完成后,返回Wireshark,然后单击Capture-> Stop(Ctrl-E)。
In the list of packets, find the one that starts with GET /api/v4/arist/
..., right-click and select "Follow TCP Stream" — That will show you exactly what is being sent and received. 在数据包列表中,找到一个以GET /api/v4/arist/
...开头的数据包,右键单击并选择“关注TCP流” —这将确切显示正在发送和接收的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.