mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
add fid and url to filer post result
fix https://github.com/chrislusf/seaweedfs/issues/274
This commit is contained in:
parent
4f47b8cff9
commit
535b1610c8
|
@ -23,6 +23,14 @@ type analogueReader struct {
|
||||||
// So that it implements the io.ReadCloser interface
|
// So that it implements the io.ReadCloser interface
|
||||||
func (m analogueReader) Close() error { return nil }
|
func (m analogueReader) Close() error { return nil }
|
||||||
|
|
||||||
|
type FilerPostResult struct {
|
||||||
|
Name string `json:"name,omitempty"`
|
||||||
|
Size uint32 `json:"size,omitempty"`
|
||||||
|
Error string `json:"error,omitempty"`
|
||||||
|
Fid string `json:"fid,omitempty"`
|
||||||
|
Url string `json:"url,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
func (fs *FilerServer) PostHandler(w http.ResponseWriter, r *http.Request) {
|
func (fs *FilerServer) PostHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
query := r.URL.Query()
|
query := r.URL.Query()
|
||||||
replication := query.Get("replication")
|
replication := query.Get("replication")
|
||||||
|
@ -138,8 +146,15 @@ func (fs *FilerServer) PostHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
writeJsonError(w, r, http.StatusInternalServerError, db_err)
|
writeJsonError(w, r, http.StatusInternalServerError, db_err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
w.WriteHeader(http.StatusCreated)
|
|
||||||
w.Write(resp_body)
|
reply := FilerPostResult{
|
||||||
|
Name: ret.Name,
|
||||||
|
Size: ret.Size,
|
||||||
|
Error: ret.Error,
|
||||||
|
Fid: fileId,
|
||||||
|
Url: urlLocation,
|
||||||
|
}
|
||||||
|
writeJsonQuiet(w, r, http.StatusCreated, reply)
|
||||||
}
|
}
|
||||||
|
|
||||||
// curl -X DELETE http://localhost:8888/path/to
|
// curl -X DELETE http://localhost:8888/path/to
|
||||||
|
|
Loading…
Reference in a new issue