Beispiel #1
0
func FindEmployee() *req.Rest {
	q := `GET /megacorp/employee/%s`
	id := "1"

	if len(os.Args) >= 2 && os.Args[1] != "" {
		id = os.Args[1]
	}

	code := fmt.Sprintf(q, id)
	r, err := shorthand.Parse(code)
	if err != nil {
		fmt.Println(err)
	}
	return r.OnLoopback(9200)
}
Beispiel #2
0
func PutEmployee() *req.Rest {
	s := `PUT /megacorp/employee/%s
{
	"first_name": "John",
	"last_name": "Smith",
	"age": 25,
	"about": "I love to go rock climbing",
	"interests": [ "sports", "music" ]
}
`
	id := "1"
	if len(os.Args) >= 2 && os.Args[1] != "" {
		id = os.Args[1]
	}
	code := fmt.Sprintf(s, id)
	r, err := shorthand.Parse(code)
	if err != nil {
		fmt.Println(err)
	}
	return r.OnLoopback(9200)
}