1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-12-11 16:05:00 +00:00
Commit graph

38 commits

Author SHA1 Message Date
Benbebop 6f5a53063f utils: dont set http.Client timeout to a default value 2024-09-16 13:33:25 +07:00
Cléo Rebert d36955acea Move away from github.com/pkg/errors
Signed-off-by: Cléo Rebert <cleo.rebert@gmail.com>
2023-09-19 11:37:24 -07:00
diamondburned 99e5f6c2b8
httpdriver: Fix MockRequest.AddHeader crash 2022-12-09 15:39:33 -08:00
diamondburned b3b2478481
httpdriver: ExpectMockRequest should return error instead 2022-12-08 19:48:57 -08:00
diamondburned ea4beab6bd
httpdriver: Fix MockResponse not impl'ing Response 2022-12-08 19:42:22 -08:00
diamondburned bf75621068
httpdriver: Add ExpectMockRequest
This commit adds the httpdriver.ExpectMockRequest function, which will
be super useful for testing inside and outside the library.
2022-12-08 19:38:59 -08:00
diamondburned 3bb8c2b019
httpdriver: Add Method into MockRequest 2022-12-08 19:17:28 -08:00
diamondburned d4bfd69cf6
httpdriver: Add Mock{Request,Response}
This commit adds MockRequest and MockResponse to aid in testing.

It doesn't provide a MockClient, since there are multiple testing
strategies and we don't want to do them all.
2022-12-08 17:16:11 -08:00
diamondburned 05948ac1ec
httputil: Fix incorrect Content-Type header 2022-04-02 22:34:41 -07:00
diamondburned 7af6e23569
utils/httputil: Fix build error from previous commit 2021-11-29 12:41:13 -08:00
diamondburned 1e14369fc0
utils/httputil: HTTPError print JSON error if possible 2021-11-29 12:28:51 -08:00
diamondburned 331ec59dec discord: Refactor interactions and components
This commit gets rid of contain-it-all structs and instead opt for
interface union types containing underlying concrete types with no
overloading.

The code is much more verbose by doing this, but the API is much nicer
to use. The only disadvantage in that regard is the interface assertion
being too verbose and risky for users at times.
2021-11-12 11:38:36 -08:00
Samuel Hernandez 40e1a3757d *: Migrated Go Modules to v3 2021-06-01 19:59:01 -07:00
diamondburned 5252b5af8d httputil: Fix Timeout causing premature cancelation 2021-01-24 22:45:56 -08:00
diamondburned de3049b730 httputil: Fixed JSON body not reusable 2021-01-13 15:22:45 -08:00
diamondburned 808dfb28bb httputil: Fixed Multipart writer not closing 2020-12-16 14:08:31 -08:00
diamondburned 525d0bb3f6 API: Move ExecuteWebhookData, add package sendpart for uploads
This commit moved ExecuteWebhookData from package api to package webhook
inside package api. This change required splitting the multipart
abstractions away from package api, so they are now inside package
sendpart in utils.

This commit will break code that uploads anything, as the type name is
now sendpart.File from api.SendMessageFile. The behavior should be the
same as before.
2020-12-16 13:11:11 -08:00
diamondburned d65807ce15 API: Potential rate limit fix for reactions 2020-12-11 17:58:52 -08:00
Maximilian von Lindern 0a8b24339b
API: Added timeout if deadline is after rate limit (#173)
* Rate: don't sleep if sleep exceeds context deadline

* Httputil: add Client.Timeout

* Bot: set default API timeout to 5 minutes

* Rate: reduce calls to time.Now in Acquire

* API: Optimize to use deadline instead of recalculating

Co-authored-by: diamondburned <datutbrus@gmail.com>
2020-11-25 12:08:42 -08:00
diamondburned 1aaa2cbfe2 httputil: Removed debug logs 2020-11-14 15:36:18 -08:00
diamondburned 6cbe95d2b3 State: Fixed erroneous context setting and races in Ready 2020-11-14 15:30:18 -08:00
diamondburned f6e270ae9c json: Fixed a race condition with erroneous JSON streams 2020-11-14 14:18:50 -08:00
diamondburned 75df94d9f4 *: Migrated Go Modules to v2 2020-10-28 15:39:59 -07:00
diamondburned 94cca0adca httputil: Fixed unlock of unlocked mutex bug 2020-08-04 14:09:43 -07:00
mavolin 41ce1f389e
make all error messages lowercase 2020-05-16 23:14:49 +02:00
diamondburned (Forefront) a298160529 API: Fixed schema error 2020-05-09 16:25:24 -07:00
diamondburned (Forefront) 0f38294048 API: Added GuildWithCount 2020-05-09 14:59:39 -07:00
diamondburned (Forefront) 3a43e413d8 Utils: Deprecated client-scoped JSON driver 2020-05-07 20:43:46 -07:00
diamondburned (Forefront) 52ca6638f5 Discord: Fixed incorrect Audit Log structures 2020-05-07 20:01:44 -07:00
mavolin e7c1c891fb
Utils: Create Constant for HTTP status code 429 2020-05-07 18:49:07 +02:00
mavolin c7a392f836
Utils: Fix #25 2020-05-07 18:36:15 +02:00
diamondburned (Forefront) cb525ca5c0 Utils: Fixed a nil dereference bug 2020-05-05 15:36:14 -07:00
diamondburned (Forefront) 0c24ac627b Utils: Fixed bug where retries aren't applied options again, causing rate limits 2020-05-05 15:32:28 -07:00
diamondburned (Forefront) a0bccd9c35 API: Added WithContext API, closes #15 2020-05-03 14:02:03 -07:00
diamondburned (Forefront) 2f076c041e Gateway: Migrated functions and variables to other packages, added JSON default codecs 2020-04-23 23:34:08 -07:00
diamondburned (Forefront) 2afe683b7d Utils: Added HTTP drivers 2020-04-19 14:53:53 -07:00
diamondburned (Forefront) b9384042bb Gateway: Added GatewayBot 2020-04-19 09:17:04 -07:00
diamondburned (Forefront) be12849668 Changed internal/ to utils/, allowing external imports 2020-04-08 19:28:40 -07:00