mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-18 08:26:38 +02:00
3d7d5ce6b4
* api: add static router and improve path parser in rpc handler Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org> * expose metadata context key to be able to get unmodified map keys Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org> * server/grpc: fix jsonpb codec for protobuf msg Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org> * api/handler/rpc: write 204 status code when rsp is nil Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org> * api/handler/rpc: add check for nil response for non javascript Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
25 lines
631 B
Go
25 lines
631 B
Go
// Package router provides api service routing
|
|
package router
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/micro/go-micro/v2/api"
|
|
)
|
|
|
|
// Router is used to determine an endpoint for a request
|
|
type Router interface {
|
|
// Returns options
|
|
Options() Options
|
|
// Stop the router
|
|
Close() error
|
|
// Endpoint returns an api.Service endpoint or an error if it does not exist
|
|
Endpoint(r *http.Request) (*api.Service, error)
|
|
// Register endpoint in router
|
|
Register(ep *api.Endpoint) error
|
|
// Deregister endpoint from router
|
|
Deregister(ep *api.Endpoint) error
|
|
// Route returns an api.Service route
|
|
Route(r *http.Request) (*api.Service, error)
|
|
}
|