Last active
December 15, 2015 10:39
-
-
Save jpfuentes2/5247504 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rack' | |
require 'sinatra/base' | |
class App < Sinatra::Base | |
use Rack::Static, :urls => ["/js"], :root => '.' | |
not_found do | |
halt 404, "nawp" | |
end | |
error 404 do | |
halt 404, "nawp" | |
end | |
error do | |
halt 404, "nawp" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
code λ curl -v localhost:9292/js/not-found.js | |
* About to connect() to localhost port 9292 (#0) | |
* Trying ::1... | |
* Connection refused | |
* Trying 127.0.0.1... | |
* connected | |
* Connected to localhost (127.0.0.1) port 9292 (#0) | |
> GET /js/not-found.js HTTP/1.1 | |
> User-Agent: curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8r zlib/1.2.5 | |
> Host: localhost:9292 | |
> Accept: */* | |
> | |
< HTTP/1.1 404 Not Found | |
< Content-Type: text/plain | |
< Content-Length: 33 | |
< X-Cascade: pass | |
< X-Content-Type-Options: nosniff | |
< Connection: keep-alive | |
< Server: thin 1.5.0 codename Knife | |
< | |
File not found: /js/not-found.js | |
* Connection #0 to host localhost left intact | |
* Closing connection #0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment