Permalink
Browse files

Preserving query string. Thanks to JH.

  • Loading branch information...
1 parent cde6c50 commit 42b45bf10e7f10fc60ed71c958227ecc302bacf6 @nstielau nstielau committed Oct 19, 2010
Showing with 3 additions and 3 deletions.
  1. +3 −3 ruby/basic_auth.rb
View
@@ -8,11 +8,11 @@
url = URI.parse("http://lsapi.seomoz.com/linkscape/#{API_CALL}/#{URL}")
puts url.to_s
-Net::HTTP.start(url.host) {|http|
- req = Net::HTTP::Get.new(url.path)
+Net::HTTP.start(url.host) do |http|
+ req = Net::HTTP::Get.new(url.request_uri)
req.basic_auth ACCESS_ID, SECRET_KEY
response = http.request(req)
result = response.body
# 'result' is now the JSON string returned fron the API
puts result
-}
+end

0 comments on commit 42b45bf

Please sign in to comment.