コード例 #1
0
// Decode_FooService_CountTo decodes an http.Request into a CountToRequest.
func Decode_FooService_CountTo(req *http.Request) (interface{}, error) {
	var ret CountToRequest

	qry := req.URL.Query()
	_ = qry

	if val := qry.Get("target"); val != "" {
		if err := runtime.Decode(&ret.Target, val); err != nil {
			return nil, err
		}
	}

	parts := strings.Split(req.URL.Path, "/")
	if len(parts) < 4 {
		return nil, errors.New("Missing Parameters.")
	}

	if err := runtime.Decode(&ret.Target, parts[3]); err != nil {
		return nil, err
	}

	return &ret, nil
}
コード例 #2
0
// Decode_FooService_SayHello decodes an http.Request into a HelloRequest.
func Decode_FooService_SayHello(req *http.Request) (interface{}, error) {
	var ret HelloRequest

	qry := req.URL.Query()
	_ = qry

	if val := qry.Get("who"); val != "" {
		if err := runtime.Decode(&ret.Who, val); err != nil {
			return nil, err
		}
	}

	parts := strings.Split(req.URL.Path, "/")
	if len(parts) < 2 {
		return nil, errors.New("Missing Parameters.")
	}

	return &ret, nil
}