You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
404s are cacheable and some systems respond with cache friendly response headers. A public site that responds with cache 404s is https://www.theonion.com/.
RestClient raises an exception when a request results in a 404 response. Unfortunately, cached 404 responses break this behavior.
uncached requests that result in 404s will raise a RestClient exceptions: RestClient::NotFound: 404 Not Found
cached requests that result in 404s return an instance ofRestClient::Response
Using
ruby 2.5.1
rack-cache (1.7.1)
rest-client (2.0.2)
rest-client-components (1.5.0)
to recreate:
require'restclient'require'restclient/exceptions'require'restclient/components'require'rack/cache'RestClient.enableRack::Cachebegin# this should throw a RestClient exceptionRestClient.get('https://www.theonion.com/tag/askdfkasdj')raise'I guess we did not get an exception from the 404'rescueRestClient::ResourceNotFound=>eputs'the first request raised a 404 exception'endresponse=RestClient.get('https://www.theonion.com/tag/askdfkasdj')puts'the second request did not raise a 404 exception'puts"second response was of type: #{response.class}"puts"second response code: #{response.code}"
The text was updated successfully, but these errors were encountered:
404s are cacheable and some systems respond with cache friendly response headers. A public site that responds with cache 404s is
https://www.theonion.com/
.RestClient
raises an exception when a request results in a 404 response. Unfortunately, cached 404 responses break this behavior.RestClient::NotFound: 404 Not Found
RestClient::Response
Using
to recreate:
The text was updated successfully, but these errors were encountered: