mirror of
https://github.com/zhengkai/orca.git
synced 2026-02-11 14:32:25 +08:00
up
This commit is contained in:
28
server/src/core/web.go
Normal file
28
server/src/core/web.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"project/metrics"
|
||||
)
|
||||
|
||||
// WebHandle ...
|
||||
func (c *Core) WebHandle(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
p, hash, err := req(w, r)
|
||||
if err != nil {
|
||||
metrics.ReqFailCount()
|
||||
return
|
||||
}
|
||||
metrics.ReqBytes(len(p.Body))
|
||||
|
||||
pr := c.add(hash, p)
|
||||
|
||||
pr.wait()
|
||||
|
||||
if pr.err != nil {
|
||||
err500(w)
|
||||
return
|
||||
}
|
||||
|
||||
w.Write(pr.rsp)
|
||||
}
|
||||
Reference in New Issue
Block a user