Skip to content
This repository has been archived by the owner on Apr 1, 2019. It is now read-only.

Unable to override Accept header #17

Open
mpartel opened this issue Sep 24, 2012 · 1 comment
Open

Unable to override Accept header #17

mpartel opened this issue Sep 24, 2012 · 1 comment

Comments

@mpartel
Copy link

mpartel commented Sep 24, 2012

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.

@beders
Copy link
Owner

beders commented Jan 20, 2013

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants