MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / CreatePublicHandler

Function CreatePublicHandler

rest/routing.go:123–135  ·  view source on GitHub ↗

CreatePublicHandler Creates the HTTP handler for the public API of a gateway server.

(sc *ServerContext)

Source from the content-addressed store, hash-verified

121
122// CreatePublicHandler Creates the HTTP handler for the public API of a gateway server.
123func CreatePublicHandler(sc *ServerContext) http.Handler {
124 r, dbr, _ := createCommonRouter(sc, regularPrivs, publicServer)
125
126 dbr.Handle("/_session", makeHandler(sc, publicPrivs, nil, nil, (*handler).handleSessionPOST)).Methods("POST")
127 dbr.Handle("/_session", makeHandler(sc, regularPrivs, nil, nil, (*handler).handleSessionDELETE)).Methods("DELETE")
128 // The routine below is part of the CouchDB REST API, users can't create DB's via the pblic API
129 // but if the client set the 'createTarget' property of the Replicatior SG should return HTTP status 412
130 // if the db exists, and 403 if it doesn't.
131 r.Handle("/{targetdb:"+dbRegex+"}/",
132 makeHandler(sc, publicPrivs, nil, nil, (*handler).handleCreateTarget)).Methods("PUT")
133
134 return wrapRouter(sc, regularPrivs, publicServer, r)
135}
136
137// ////// ADMIN API:
138

Callers 2

StartServerFunction · 0.85
TestPublicHandlerMethod · 0.85

Calls 3

createCommonRouterFunction · 0.85
makeHandlerFunction · 0.85
wrapRouterFunction · 0.85

Tested by

no test coverage detected