2015-01-15 32 views
0

我正在使用retrofit来做出一些网络请求,但不确定要使用哪个@annotation,我设法使用PostMan实用程序成功请求,但无法在android应用程序上正确获取它。因此我想从网络督察调试。改造调试,生成网络请求信息

如何使用我的android应用/仿真器生成类似下面的日志/报告?

POST /path/to/api/ HTTP/1.1 
Content-Length: [length] 
Content-Type: multipart/form-data; boundary=iSBcxYW-SeE_dubqNJw3p6PP59WbDOAj 

--iSBcxYW-SeE_dubqNJw3p6PP59WbDOAj 
Content-Disposition: form-data; name="file" 

test 
--iSBcxYW-SeE_dubqNJw3p6PP59WbDOAj-- 

回答

3

您可以设置日志级别以在日志中看到你的restadapter的改造: -

RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint(your_url_endpoint) 
      .setRequestInterceptor(requestInterceptor) 
      .setLogLevel(RestAdapter.LogLevel.FULL) 
      .setLog(new AndroidLog("your log tag")) 
      .build();