Proxy
Set global proxy
All calls to RestMan, including Resources, will use the proxy specified by RestMan.proxy
.
HEAD
/test
HTTP/1.1
Accept: */*
Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
User-Agent: rest-man/1.1.0 (darwin21 arm64) ruby/3.1.2p20
Host: example.com
proxy
HTTP/1.1
200
OK
Content-Type: text/plain
Hello world!
RestMan.proxy = "http://proxy.example.com"
RestMan.get "http://example.com/test"
response.code #=>200
RestMan.proxy = "http://proxy.example.com"
response = RestMan::Request.execute(
method: :get,
url: "http://example.com/test"
)
response.code #=>200
RestMan.proxy = "http://proxy.example.com"
resource = RestMan::Resource.new("http://example.com/test")
resposne = resource.get
response.code #=>200
RestMan CLI hasn't support proxy customization.
Set per-request proxy
Specify a per-request proxy by passing the :proxy option to RestMan::Request. This will override any proxies set by environment variable
or by the global RestMan.proxy
value.
HEAD
/test
HTTP/1.1
Accept: */*
Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
User-Agent: rest-man/1.1.0 (darwin21 arm64) ruby/3.1.2p20
Host: example.com
proxy
HTTP/1.1
200
OK
Content-Type: text/plain
Hello world!
RestMan simple mode hasn't support per-request proxy customization.
Please use advance mode.
response = RestMan::Request.execute(
method: :get,
url: "http://example.com/test",
proxy: "http://proxy.example.com"
)
response.code #=>200
RestMan Resource hasn't support per-request proxy customization.
Please use advance mode.
RestMan CLI hasn't support proxy customization.
Disable proxy for a particular request
HEAD
/test
HTTP/1.1
Accept: */*
Accept-Encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
User-Agent: rest-man/1.1.0 (darwin21 arm64) ruby/3.1.2p20
Host: example.com
HTTP/1.1
200
OK
Content-Type: text/plain
Hello world!
RestMan simple mode hasn't support per-request proxy customization.
Please use advance mode.
RestMan.proxy = "http://proxy.example.com"
response = RestMan::Request.execute(
method: :get,
url: "http://example.com/test",
proxy: nil
)
response.code #=>200
RestMan Resource hasn't support per-request proxy customization.
Please use advance mode.
RestMan CLI hasn't support proxy customization.