Remove postRefs end point (#1761)

This commit is contained in:
Rafael Weinstein
2016-06-08 15:23:05 -07:00
parent 99f757f823
commit 10482e26e4
4 changed files with 0 additions and 21 deletions
-2
View File
@@ -63,8 +63,6 @@ func main() {
}
prefix := dsPathPrefix + "/:store"
router.POST(prefix+constants.PostRefsPath, routeToStore(stores, datas.HandlePostRefs))
router.OPTIONS(prefix+constants.PostRefsPath, routeToStore(stores, datas.HandlePostRefs))
router.POST(prefix+constants.GetRefsPath, routeToStore(stores, datas.HandleGetRefs))
router.OPTIONS(prefix+constants.GetRefsPath, routeToStore(stores, datas.HandleGetRefs))
router.GET(prefix+constants.RootPath, routeToStore(stores, datas.HandleRootGet))
-1
View File
@@ -8,6 +8,5 @@ const (
RootPath = "/root/"
GetRefsPath = "/getRefs/"
HasRefsPath = "/hasRefs/"
PostRefsPath = "/postRefs/"
WriteValuePath = "/writeValue/"
)
-1
View File
@@ -47,7 +47,6 @@ func (s *remoteDatabaseServer) Run() {
router.POST(constants.HasRefsPath, s.makeHandle(HandleHasRefs))
router.GET(constants.RootPath, s.makeHandle(HandleRootGet))
router.POST(constants.RootPath, s.makeHandle(HandleRootPost))
router.POST(constants.PostRefsPath, s.makeHandle(HandlePostRefs))
router.POST(constants.WriteValuePath, s.makeHandle(HandleWriteValue))
srv := &http.Server{
-17
View File
@@ -26,23 +26,6 @@ type URLParams interface {
type Handler func(w http.ResponseWriter, req *http.Request, ps URLParams, cs chunks.ChunkStore)
// HandlePostRefs puts a bunch of chunks into cs without doing any validation. This is bad and shall be done away with once we fix BUG 822.
func HandlePostRefs(w http.ResponseWriter, req *http.Request, ps URLParams, cs chunks.ChunkStore) {
err := d.Try(func() {
d.Exp.Equal("POST", req.Method)
reader := bodyReader(req)
defer reader.Close()
chunks.Deserialize(reader, cs, nil)
w.WriteHeader(http.StatusCreated)
})
if err != nil {
http.Error(w, fmt.Sprintf("Error: %v", err), http.StatusBadRequest)
return
}
}
func bodyReader(req *http.Request) (reader io.ReadCloser) {
reader = req.Body
if strings.Contains(req.Header.Get("Content-Encoding"), "gzip") {