Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

v0.2.0

Latest
Compare
Choose a tag to compare
@sleeyax sleeyax released this 10 Sep 17:08

Most notable changes:

  • Fixed race conditions. Now you can just have one client instance doing a bunch of requests concurrently!
// ...
client, _ := NewClient(&Options{
	PrefixURL: "https://example.com",
})

var wg sync.WaitGroup

sendRequest := func() {
	client.Get("test", &Options{
		SearchParams: urlValues.Values{
			"foo": {"bar"},
			"abc": {"def"},
		},
	})

	wg.Done()
}

for i := 0; i < 10; i++ {
	wg.Add(1)
	go sendRequest()
}

wg.Wait()

// At this point 10 requests have been sent concurrently.
  • Fixed several small bugs
  • Updated dependencies
  • Breaking change: renamed client.Update to client.Put (this was a typo, but still).
  • Breaking change: removed the custom MaxRetriesExceededError struct and replaced it with a regular error message instead.

Before:

res, err := client.Get("https://example.com/")
if _, ok := err.(*MaxRedirectsExceededError); !ok {
   // error is NOT MaxRedirectsExceededError
}

Now:

res, err := client.Get("https://example.com/")
if err != MaxRetriesExceededError {
   // error is NOT MaxRedirectsExceededError
}

Related commits: v0.1.0...v0.2.0