Page MenuHomeMusing Studio

No OneTemporary

diff --git a/request.go b/request.go
new file mode 100644
index 0000000..0f170a1
--- /dev/null
+++ b/request.go
@@ -0,0 +1,13 @@
+package impart
+
+import (
+ "mime"
+ "net/http"
+)
+
+// ReqJSON returns whether or not the given Request is sending JSON, based on
+// the Content-Type header being application/json.
+func ReqJSON(r *http.Request) bool {
+ ct, _, _ := mime.ParseMediaType(r.Header.Get("Content-Type"))
+ return ct == "application/json"
+}

File Metadata

Mime Type
text/x-diff
Expires
Sat, Nov 23, 7:21 AM (1 d, 17 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3104440

Event Timeline