2016-02-07 23 views
1

我正在使用rest-client-builder:1.0.3 grails插件與REST API DSpace進行通信。 這非常適用:在grails中使用rest客戶端構建器的具體名稱的錯誤2.3.4

def resp = rest.post("http://10.42.0.239:8080/rest/login"){ 
     contentType "application/json" 
     json{ 
      email = "[email protected]" 
      password = "root" 
     } 
    } 

但我需要用減號以這種方式傳遞一個參數:

def status = rest.get("http://10.42.0.239:8080/rest/status"){ 
      contentType "application/json" 
      json{ 
       rest-dspace-token = "4506b187-bda8-4db7-801d-635f277d5316" 
      } 
     } 

在零下休息,dSPACE的令牌標誌給下一個錯誤:

((rest - dspace) - token) is a binary expression, but it should be a variable expression at line 

我該如何解決這個問題? 在此先感謝。

+0

對不起,我錯了。問題不在於數據,而在於標題。 在rest-client-builder的2.1.1版本中,問題得以解決。 –

回答

2

只是引用它爲代表的屬性:

 json{ 
      delegate.'rest-dspace-token' = "4506b187-bda8-4db7-801d-635f277d5316" 
     }