Fixes after review

- It's confusing. If there is no difference, I suggest having the route named after the protocol verb or resulting handler. So it should be either post or upload.
- Don't you find that it would be more understandable without else ifs?
- Why do we need a temporary file here?
- etc

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
This commit is contained in:
Evgeniy Kulikov 2021-01-26 18:36:53 +03:00
parent 3cbd4dbd09
commit ec70bfa4cc
No known key found for this signature in database
GPG key ID: BF6AEE0A2A699BF2
3 changed files with 50 additions and 32 deletions

4
app.go
View file

@ -181,8 +181,8 @@ func (a *app) Serve(ctx context.Context) {
r := router.New()
r.RedirectTrailingSlash = true
a.log.Info("enabled /put/{cid}")
r.POST("/put/{cid}", a.upload)
a.log.Info("enabled /upload/{cid}")
r.POST("/upload/{cid}", a.upload)
a.log.Info("enabled /get/{cid}/{oid}")
r.GET("/get/{cid}/{oid}", a.byAddress)