restclient.el
restclient.el copied to clipboard
Disable 302 redirect
Is there any way to disable 302 redirect, please?
Hm... I vaguely remember doing something to stop automatic redirects. But it's clear it doesn't work anymore indeed. Or I forgot to implement it.
Anyways, I'll have a look...
Ah ok, I see now. If you need it fast, just customize url-max-redirections
variable to 0, but this may affect any other libraries that use url.el, so please don't forget to reset it back when something else breaks :)
I'll make it set it 0 automatically and then restore back after request when I have spare moment. Thank you for noticing this.
Amazing, it works! Thank you!
Would be great if this plug-in didn't follow redirects (301 and 303 as well) by default but good to know there is a work-around
I'd love to have a solution to this redirect issue so I can test an OAuth2 workflow.
Specifically, I'd love to turn off following for all redirect response codes 301
, 302
, and 303
I've tried this:
# -*- mode: restclient; url-max-redirections: 0 -*-
as well as setting variables directly in emacs, but it always follows the redirects.
I would expect it to instead return a 30X
response code and associated response info.
I'm using the latest restclient
, has this feature been taken out? Or is there another way to do it?
You may need to make the variable buffer-local: (make-variable-buffer-local 'url-max-redirections)
. Then revert the buffer, and the file-local variable should work.
I am not able to make this work either way - global or buffer local. It always automatically follows the redirect and doesn't retain the url it's redirected to (which in the case of oauth, contains the stuff I'm looking for).
I know it's bit late to the party but I was hit by this recently. Poking around I've noticed that url-max-redirection
is a custom variable. According to this answer proper way to modify those is via custom-set-variables
. Indeed when I set it like:
(custom-set-variables '(url-max-redirections 0))
so it takes a proper effect even in the current buffer.