2015-01-15 38 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();