mirror of
https://github.com/dolthub/dolt.git
synced 2026-04-26 03:30:09 -05:00
Remove postRefs end point (#1761)
This commit is contained in:
@@ -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))
|
||||
|
||||
@@ -8,6 +8,5 @@ const (
|
||||
RootPath = "/root/"
|
||||
GetRefsPath = "/getRefs/"
|
||||
HasRefsPath = "/hasRefs/"
|
||||
PostRefsPath = "/postRefs/"
|
||||
WriteValuePath = "/writeValue/"
|
||||
)
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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") {
|
||||
|
||||
Reference in New Issue
Block a user