nicksrandall / quest

A request library for Go with a chain-able API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Quest

GoDoc A request (http) library for Go with a convenient, chain-able API.

Errors

If any method in the request's life-cycle errors, the every subsequent method will short circut and not be called. The Done method will return the first error that occured so that it can be handled.

Example

func GetUser(ctx context.Context, userId string) (user.User, error) {
	var user user.User
	err := quest.Post("/api/to/user/endpoint").
		WitContext(ctx). // used for open tracing
		QueryParam("includeDetails", "true").
		JSONBody(userId).
		Send().
		ExpectSuccess().
		GetJSON(&user).
		Done()

  return  user, err
}

Open Tracing

About

A request library for Go with a chain-able API

License:MIT License


Languages

Language:Go 100.0%