2016-02-11 106 views
1
curl --request PROPFIND --url "http://carddav.mail.aol.com/home/[email protected]/Contacts/" --header "Content-Type: text/xml" --header "Depth: 1" --data '<A:propfind xmlns:A="DAV:"><A:prop><A:getetag /><D:address-data xmlns:D="urn:ietf:params:xml:ns:carddav"/></A:prop></A:propfind>' --header "Authorization: Bearer fjskdlfjds" 

Net :: HTTP中是否有一个特殊的方法允许propfind命令?如何在Ruby中运行此curl命令?

回答

0
Net::HTTP::Propfind 

下面是一个例子:

uri = URI.parse('http://example.com') 
http = Net::HTTP.new(uri.host, uri.port) 
request = Net::HTTP::Propfind.new(uri.request_uri) 

# Set your body (data) 
request.body = "Here's the body." 

# Set your headers: one header per line. 
request["Content-Type"] = "application/json" 

response = http.request(request) 
+0

谢谢!我不认为这会很简单。 –

+0

不客气。这对我来说并不简单...... –