Resty icon indicating copy to clipboard operation
Resty copied to clipboard

Unable to override Accept header

Open mpartel opened this issue 12 years ago • 1 comments

Resty won't let me override Accept, it only lets me add stuff to it. My Rails app is serving a Resty.text() request with HTML because Resty places text/html before text/plain in its Accept. Neither dontSend nor alwaysSend allow me ot override this behavior.

mpartel avatar Sep 24 '12 03:09 mpartel

A bit late for a reply, but you could create your own Resty option that changes the header.

class OverrideAccept extends Resty.Option {
   @Override public void apply(URLConnection aConnection) {
    aConnection.setRequestProperty("Accept", "text/html");
      }
}

Then pass an instance to this option into your Resty instance

beders avatar Jan 20 '13 06:01 beders