Read more

RestClient sends XML Accept header by default

Thomas Eisenbarth
February 20, 2012Software engineer at makandra GmbH

REST Client Show archive.org snapshot is a nice, simple HTTP client library for Ruby.

Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

When you do a simple GET request like that:

RestClient.get 'http://example.com/'

it will result in this request beeing sent to www.example.com:

GET / HTTP/1.1
Accept: */*; q=0.5, application/xml
Accept-Encoding: gzip, deflate
Host: www.example.com

The application/xml accept header might lead to unexpected results on your server. You can force REST Client to ask the server for default text/html that way:

RestClient.get(site, {:accept => :html})
Posted by Thomas Eisenbarth to makandra dev (2012-02-20 11:01)