api minor improvements (#1526)
* api/handler/rpc: unblock all http methods and set Host meta * api/router/static: add debug log Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
5b5c73457b
commit
5e650deb07
6
rpc.go
6
rpc.go
@ -100,8 +100,7 @@ func (h *rpcHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
// only allow post when we have the router
|
||||
if r.Method != "GET" && (h.opts.Router != nil && r.Method != "POST") {
|
||||
if h.opts.Router == nil && r.Method != "GET" {
|
||||
writeError(w, r, errors.MethodNotAllowed("go.micro.api", "method not allowed"))
|
||||
return
|
||||
}
|
||||
@ -123,7 +122,8 @@ func (h *rpcHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
if !ok {
|
||||
md = make(metadata.Metadata)
|
||||
}
|
||||
|
||||
// fill contex with http headers
|
||||
md["Host"] = r.Host
|
||||
// merge context with overwrite
|
||||
cx = metadata.MergeContext(cx, md, true)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user