Exemple #1
0
func newEndpoint(opts *gateway.HttpRule) *endpoint {
	if opts == nil {
		return nil
	}
	switch opt := opts.GetPattern().(type) {
	case *gateway.HttpRule_Get:
		return &endpoint{"GET", opt.Get}
	case *gateway.HttpRule_Put:
		return &endpoint{"PUT", opt.Put}
	case *gateway.HttpRule_Post:
		return &endpoint{"POST", opt.Post}
	case *gateway.HttpRule_Delete:
		return &endpoint{"DELETE", opt.Delete}
	case *gateway.HttpRule_Patch:
		return &endpoint{"PATCH", opt.Patch}
	}
	return nil
}