From 0675bdb000cb067534e5f2ee214102bc8d08d900 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Thu, 16 Nov 2017 20:42:42 +0000 Subject: [PATCH] Change allowed content types on HTTP routes --- web/routes.go | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/web/routes.go b/web/routes.go index eb14c7aa..3a76cefc 100644 --- a/web/routes.go +++ b/web/routes.go @@ -90,11 +90,11 @@ func routes(s *fibre.Fibre) { s.Use(mw.Type(&mw.TypeOpts{ AllowedContent: map[string]bool{ "application/json": true, - "application/cbor": true, + "application/cork": true, "application/msgpack": true, "application/x-www-form-urlencoded": true, }, - }).PathIs("/signup")) + }).PathIs("/signup").MethodIsNot("OPTIONS")) // -------------------------------------------------- // Endpoints for authentication signin @@ -115,11 +115,11 @@ func routes(s *fibre.Fibre) { s.Use(mw.Type(&mw.TypeOpts{ AllowedContent: map[string]bool{ "application/json": true, - "application/cbor": true, + "application/cork": true, "application/msgpack": true, "application/x-www-form-urlencoded": true, }, - }).PathIs("/signin")) + }).PathIs("/signin").MethodIsNot("OPTIONS")) // -------------------------------------------------- // Endpoints for import and exporting data @@ -157,11 +157,12 @@ func routes(s *fibre.Fibre) { s.Use(mw.Type(&mw.TypeOpts{ AllowedContent: map[string]bool{ + "text/plain": true, "application/json": true, - "application/cbor": true, + "application/cork": true, "application/msgpack": true, }, - }).PathIs("/sql")) + }).PathIs("/sql").MethodIsNot("OPTIONS")) // -------------------------------------------------- // Endpoints for submitting websocket sql @@ -339,17 +340,13 @@ func routes(s *fibre.Fibre) { }) - s.Use(mw.Quit(&mw.QuitOpts{ - Timeout: 15 * time.Second, - }).PathBegsWith("/key/")) - s.Use(mw.Type(&mw.TypeOpts{ AllowedContent: map[string]bool{ "application/json": true, - "application/cbor": true, + "application/cork": true, "application/msgpack": true, "application/vnd.api+json": true, }, - }).PathBegsWith("/key/")) + }).PathBegsWith("/key/").MethodIsNot("OPTIONS")) }