Skip to content
Browse files

`server` function: Set the default Content-Type to `text/plain` inste…

  • Loading branch information...
1 parent 9850a48 commit c1c05cb460d88c6611f18265b485e0e90c3b45c9 @mathiasbynens mathiasbynens committed Dec 31, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 .functions
View
4 .functions
@@ -6,7 +6,9 @@ function md() {
# Start an HTTP server from a directory, optionally specifying the port
function server() {
local port="${1:-8000}"
- open "http://localhost:${port}/" && python -m SimpleHTTPServer "$port"
+ open "http://localhost:${port}/"
+ # Set the default Content-Type to `text/plain` instead of `application/octet-stream`
+ python -c "import SimpleHTTPServer; import sys; sys.argv = [None, '$port']; SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map[''] = 'text/plain'; SimpleHTTPServer.test();"
}
# Test if HTTP compression (RFC 2616 + SDCH) is enabled for a given URL.

0 comments on commit c1c05cb

Please sign in to comment.
Something went wrong with that request. Please try again.