Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

mime-types checked

  • Loading branch information...
commit 91f958ffe860095f3bcb82066f208ce34f60bda1 1 parent 06856a7
@brehaut authored
View
2  project.clj
@@ -6,4 +6,4 @@
:dependencies {org.clojure/clojure "1.5.0"
core.typed "0.1.8-SNAPSHOT"
- ring/ring "1.1.8"})
+ ring/ring "1.2.0-beta1"})
View
19 src/ring/typed/util/io.clj
@@ -1,7 +1,10 @@
(ns ring.typed.util.io
(:require ring.util.io
[clojure.java.io :as io]
- [clojure.core.typed :refer [ann
+ [clojure.core.typed :refer [;types
+ Option
+ ;vars
+ ann
tc-ignore
def-alias]])
(:import (java.io PipedInputStream
@@ -24,11 +27,19 @@
;; ring
-(ann piped-input-stream
+(ann ring.util.io/piped-input-stream
[[PipedOutputStream -> Any] -> PipedInputStream])
-(ann string-input-stream
+(ann ring.util.io/string-input-stream
(Fn [String -> ByteArrayInputStream]
[String String -> ByteArrayInputStream]))
-(ann close! [Closeable -> nil])
+;; 'close! is an interesting function. According to the implementation
+;; it accepts Any and returns nil, with the when test acting as an
+;; assertion about that code path. However, I have opted to type it
+;; as a nullable Closeable.
+;;
+;; The less literal implemention chosen means allows the checker
+;; to be used to determine situations where non-closeable things
+;; are passed to close!
+(ann ring.util.io/close! [(Option Closeable) -> nil])
View
14 src/ring/typed/util/mime_types.clj
@@ -0,0 +1,14 @@
+(ns ring.typed.util.mime-types
+ "Utility functions for finding out the mime-type of a file."
+ (:require [clojure.core.typed :refer [Option
+ ann]]))
+
+(ann ring.util.mime-types/default-mime-types
+ (clojure.lang.IPersistentMap String String))
+
+(ann ring.util.mime-types/filename-ext
+ [String -> (Option String)])
+
+(ann ring.util.mime-types/ext-mime-type
+ (Fn [String -> String]
+ [String (clojure.lang.IPersistentMap String String) -> String]))
Please sign in to comment.
Something went wrong with that request. Please try again.