diff --git a/lib/sawyer/response.rb b/lib/sawyer/response.rb index 684aca1..4c8713c 100644 --- a/lib/sawyer/response.rb +++ b/lib/sawyer/response.rb @@ -48,8 +48,13 @@ def process_data(data) # # Returns an array of Relations def process_rels - links = ( @headers["Link"] || "" ).split(', ').map do |link| - href, name = link.match(/<(.*?)>; rel="(\w+)"/).captures + links = ( @headers["Link"] || "" ).split(',').map do |link| + href, params = link.match(/<(.*?)>;(.*)?/).captures + name = nil + params.split(';').map do |param| + param.match(/rel="?(\w+)/) { |m| name = m[1] } + break if name + end [name.to_sym, Relation.from_link(@agent, name, :href => href)] end