auth
auth/profile.go
Support CORS. Add support for the OPTIONS method on certain endpoints. Automatically add headers (and respond to) OPTIONS requests. Note that these headers are full of deceit and mendacity, and we should switch to trout soon so we can actually be honest about what methods we support.
1.1 --- a/profile.go Sat Apr 25 22:44:36 2015 -0400 1.2 +++ b/profile.go Mon May 11 20:46:23 2015 -0400 1.3 @@ -459,10 +459,10 @@ 1.4 1.5 // RegisterProfileHandlers adds handlers to the passed router to handle the profile endpoints, like registration and user retrieval. 1.6 func RegisterProfileHandlers(r *mux.Router, context Context) { 1.7 - r.Handle("/profiles", wrap(context, CreateProfileHandler)).Methods("POST") 1.8 + r.Handle("/profiles", wrap(context, CreateProfileHandler)).Methods("POST", "OPTIONS") 1.9 // BUG(paddy): We need to implement a handler that will return information about a profile or set of profiles. 1.10 - r.Handle("/profiles/{id}", wrap(context, UpdateProfileHandler)).Methods("PATCH") 1.11 - r.Handle("/profiles/{id}", wrap(context, DeleteProfileHandler)).Methods("DELETE") 1.12 + r.Handle("/profiles/{id}", wrap(context, UpdateProfileHandler)).Methods("PATCH", "OPTIONS") 1.13 + r.Handle("/profiles/{id}", wrap(context, DeleteProfileHandler)).Methods("DELETE", "OPTIONS") 1.14 // BUG(paddy): We need to implement a handler that will add a login to a profile. 1.15 // BUG(paddy): We need to implement a handler that will remove a login from a profile. What happens to sessions created with that login? 1.16 // BUG(paddy): We need to implement a handler that will list the logins attached to a profile.