Resty
Resty copied to clipboard
Unable to override Accept header
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.
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