2013-01-02 26 views
1

我得到一個達特:HttpException:解析失敗標頭值

HttpException:無法調用使用M2 release鏢http.Client.get(URI)的方法,當解析報頭值

httpoauth2庫。我正在嘗試使用該API來執行File: get。我成功將我的授權請求重定向到一個簡單的基於控制檯的http服務器以獲取令牌。然後下面的代碼導致異常:

oauth.Credentials credentials = new oauth.Credentials(code); 
http.Client client = new oauth.Client(CLIENT_ID, CLIENT_SECRET, credentials); 
Uri uri = new Uri("https://www.googleapis.com/drive/v2/files/$fileID"); 
Future<http.Response> result = client.get(uri); 

下面是完整的堆棧跟蹤:

HttpException: Failed to parse header value 
Unhandled exception: 
FutureUnhandledException: exception while executing Future 
HttpException: Failed to parse header value 
original stack trace: 
    null 
#0  _FutureImpl._complete (bootstrap:844:11) 
#1  _FutureImpl._complete (bootstrap:848:5) 
#2  _FutureImpl._setException (bootstrap:873:14) 
#3  _CompleterImpl.completeException (bootstrap:952:30) 
#4  _FutureImpl._forwardException.<anonymous closure> (bootstrap:936:34) 
#5  _FutureImpl._complete (bootstrap:832:22) 
#6  _FutureImpl._complete (bootstrap:848:5) 
#7  _FutureImpl._setException (bootstrap:873:14) 
#8  _CompleterImpl.completeException (bootstrap:952:30) 
#9  _FutureImpl._forwardException.<anonymous closure> (bootstrap:936:34) 
#10  _FutureImpl._complete (bootstrap:832:22) 
#11  _FutureImpl._complete (bootstrap:848:5) 
#12  _FutureImpl._setException (bootstrap:873:14) 
#13  _CompleterImpl.completeException (bootstrap:952:30) 
#14  _FutureImpl._forwardException.<anonymous closure> (bootstrap:936:34) 
#15  _FutureImpl._complete (bootstrap:832:22) 
#16  _FutureImpl._complete (bootstrap:848:5) 
#17  _FutureImpl._setException (bootstrap:873:14) 
#18  _CompleterImpl.completeException (bootstrap:952:30) 
#19  _FutureImpl._forwardException.<anonymous closure> (bootstrap:936:34) 
#20  _FutureImpl._complete (bootstrap:832:22) 
#21  _FutureImpl._complete (bootstrap:848:5) 
#22  _FutureImpl._setException (bootstrap:873:14) 
#23  _CompleterImpl.completeException (bootstrap:952:30) 
#24  IOClient.send.<anonymous closure>.<anonymous closure> (package:http/src/io_client.dart:38:36) 
#25  _FutureImpl._complete (bootstrap:840:19) 
#26  _FutureImpl._complete (bootstrap:848:5) 
#27  _FutureImpl._setValue (bootstrap:862:14) 
#28  _CompleterImpl.complete (bootstrap:949:26) 
#29  async.<anonymous closure> (package:http/src/utils.dart:173:41) 
#30  _Timer._createTimerHandler._handleTimeout (dart:io:7035:28) 
#31  _Timer._createTimerHandler._handleTimeout (dart:io:7043:7) 
#32  _Timer._createTimerHandler.<anonymous closure> (dart:io:7051:23) 
#33  _ReceivePortImpl._handleMessage (dart:isolate-patch:37:92) 

回答