Commit Graph
106 Commits
Author SHA1 Message Date
aboy e5e45dad21 Add hooks support for WebSub (formerly PubSubHubbub) protocol (#2397)
Fixes: #1265.
2022-08-21 17:31:23 -04:00
Tim Rogers f2d99f17ea Include the version of go-github in User-Agent headers sent to the GitHub API (#2403) 2022-08-13 18:22:20 -04:00
Glenn Lewis 7a7a7f0943 Update URLs (#2373)
Fixes: #2360.
2022-05-24 08:43:48 -04:00
Sho Okada a58d5f0adf Add fields to RateLimits struct (#2340)
Fixes: #2339
2022-05-16 10:17:43 -04:00
Glenn Lewis 3e8a7f0fbe Clean up method return consistency (#2318) 2022-03-24 23:16:22 -04:00
Jille Timmermans 77b2d7586d Don't update the ratelimits if we got a response from a cache (#2273) 2022-02-17 11:15:14 -05:00
Glenn Lewis f5943dbb9a Fix since+page pagination bug (#2218) 2021-12-05 22:21:27 -05:00
Brian Langdon c6b75c116d Handle 'since' in addition to 'page' for pagination response (#2135) 2021-11-26 20:52:13 -05:00
Dalton Hubble a4ce810184 Parse Before/After Links into Response (#2154) 2021-11-15 11:55:08 -05:00
Alexander Melentyev 14b70d536e Fix linters issues (#2104) 2021-09-26 23:02:34 -04:00
Allan Guwatudde 9f7c203923 Add test cases to verify that error responses contain status code (#2093)
Fixes: #912.
2021-09-13 08:09:39 -04:00
w-haibara 54ec837fb6 Add TokenExpiration to Response (#2031) 2021-08-06 10:37:48 -04:00
Glenn Lewis a12f9cdc3e Add Client method (#2016)
Fixes: #1859.
2021-07-21 13:57:54 -04:00
Sagar Sonwane 2bb6770899 Add test cases for JSON resource marshaling (#1973) 2021-07-13 13:21:23 -04:00
Yusuke Kuoka 3ad61691b5 Add support for listing and getting repository/organization webhook deliveries (#1934)
Fixes: #1933.
2021-07-13 13:05:37 -04:00
Alexis Gauthiez cfcb8e1140 Enable Client.RateLimits to bypass the rate limit check (#1907)
Fixes #1899.
2021-07-08 16:13:45 -04:00
Nilesh Singh c9fec828b8 Modify GetBranch to handle redirects (#1901)
Fixes #1895.
2021-07-08 15:43:22 -04:00
Fabian Holler 30283c95f1 errorResponse: define struct types instead of using anonymous structs 2021-07-08 10:48:39 +02:00
Sagar Sonwane 51e7595f87 fix: Updated comparisons in test files (#1875)
Replaced all reflect.DeepEqual comparisons in test files with cmp.Equal.

Fixes: #1851
2021-05-26 11:49:24 -07:00
Munia Balayil 7a077bbd73 Update error handling as per Go 1.13 guidelines (#1854)
Fixes: #1846.
2021-04-14 17:09:14 -04:00
Adrien Delorme 9318e629ec Add client.BareDo to allow user to handle the body (#1772) 2021-01-13 15:45:25 -05:00
Glenn Lewis 7081b5fe34 Improve repos.go coverage (#1768) 2020-12-26 11:39:11 -05:00
Glenn Lewis 38622b1c82 Improve actions_workflow_runs.go coverage (#1698) 2020-12-25 12:22:45 -05:00
Glenn Lewis 653916a994 Clean up coverage tests in checks_test.go (#1682) 2020-12-24 20:31:48 -05:00
Glenn Lewis 8e13abb977 Improve github.go code coverage (#1670) 2020-12-18 22:26:15 -05:00
Glenn Lewis 460db534b8 Refactor context.Background in tests (#1672) 2020-12-16 05:58:28 -05:00
Glenn Lewis a64f3a6d08 Update URLs (#1659) 2020-12-02 10:39:08 -05:00
Glenn Lewis 159b448168 Switch to new GitHub v3 API Documentation website (#1621) 2020-09-01 18:30:47 -04:00
Piyush Chugh 5f52968649 Fix GitHub Enterprise API subdomain (#1599)
Fixes: #1552.
2020-08-21 23:12:54 -04:00
SteelPhase 378bcfd2d1 Correct Enterprise upload url (#1510) 2020-04-27 20:58:39 -04:00
Alex Orr 07c03e832b Support for deprecating API authentication through query parameters (#1469) 2020-03-27 08:10:30 -04:00
Glenn Lewis 2078be4104 Support cursor pagination (#1384) 2020-01-20 13:01:00 -05:00
haya14busa be5502b713 Support unexpected error structure (#1364)
Fixes #540.
Related: #1136.
2020-01-07 21:14:12 -05:00
haya14busa b57bcf63fe Re-populate HTTP response body of ErrorResponse (#1363)
Fixes #1136.
2020-01-07 21:04:57 -05:00
Ioannis Georgoulas 1a07ca55c9 Add context nil check on client Doer (#1348)
Fixes #1260.
2019-12-09 09:20:32 -05:00
Sergio Garcia 81eca3eea3 Test for marshalling Organizations and make JSON comparison non sensitive to key order (#1303)
Helps #55.
2019-12-05 07:56:52 -05:00
tkhandel 0e41ab9770 Simplify rate limit error check (#1321)
Fixes #1318.
2019-12-05 07:55:17 -05:00
Daoq a01ea50f2f Add default enterprise suffix when creating an enterprise method (#958) (#1165)
Fixes #958.
2019-09-17 20:18:10 -04:00
Glenn Lewis 0573e88402 Add gen-stringify-test.go (#1196) 2019-06-20 21:47:17 -04:00
Ricco Førgaard 8bcc0479b1 Add tests for resource JSON marshaling and unmarshaling (#1189)
Helps #55.
2019-06-11 08:05:50 -04:00
Glenn Lewis 6264c79745 Return new http.Client when nil passed to NewClient (#1178)
Fixes #1173.
2019-05-29 22:05:01 -04:00
Oleg Kovalov 530b7c552e Fix named consts (#962) 2018-08-03 21:59:44 -04:00
Ben Batha dcc59e61eb Detect abuse rate limits on GitHub Enterprise instances. (#865)
On GitHub Enterprise, the documentation URL for abuse limit errors
is not the same as for the public GitHub API.

The documentation URL in abuse limit errors on public GitHub API is:

"https://developer.github.com/v3/#abuse-rate-limits"

GitHub Enterprise instances will return a version-specific URL, such as:

"https://developer.github.com/enterprise/2.12/v3/#abuse-rate-limits"

This changes the error type check to detect AbuseRateLimitError error
in a GitHub-version-agnostic way.
2018-04-19 19:21:32 -04:00
Sahil Dua 922ceac058 tests: make use of testMethod consistent (#832)
Use testMethod to test the request method instead of manually comparing
it and testing. This change is to make things consistent through out the
code base.

Fixes #829.
2018-01-16 14:59:09 -08:00
Carlos Alexandro Becker 7f2e27fab6 fix: abuse rate limits handling (#826) 2018-01-16 09:20:17 -08:00
Chris King df88dd9538 Remove global test variables in favor of local. (#766)
This refactor removes the global test variables used by all tests,
replacing them with local variables that are independent in each test.

This is better style, easier to read and be confident about correctness,
and allows tests to be parallelized in the future.

Resolves #762.
2017-12-02 14:34:41 -05:00
Sahil Dua 5bdf02dd29 gen-accessors: add support for named structs (#770) 2017-11-07 16:07:28 -08:00
Chris King f385f2710b Add NewEnterpriseClient method. (#763)
This is a convenience helper for creating an enterprise client with
custom URLs. Previous code that uses NewClient and sets its
BaseURL, UploadURL fields is still valid. This method is for convenice
and better discoverability within godoc. It also aligns with a similar
method in githubql package (for GitHub API v4).

Resolves #756.
2017-10-30 03:13:04 -04:00
Dmitri Shuralyov 7de811820d Use non-empty Client.BaseURL path in tests.
The goal of this change is to catch bugs where endpoint uses an
absolute URL rather than relative. The difference in behavior only
occurs when a non-empty BaseURL path is used. So we do that.

We do it in a way that doesn't require rewriting a lot of tests or
shifting the responsibility of catching this mistake to writing the
test correctly. Instead, it's a global automated check.

With this change, a test for an endpoint would now fail if that method
incorrectly uses an absolute URL. For example:

	$ go test
	FAIL: Client.BaseURL path prefix is not preserved in the request URL:

		/users?page=2&since=1

		Did you accidentally use an absolute endpoint URL rather than relative?
		See https://github.com/google/go-github/issues/752 for information.
	--- FAIL: TestUsersService_ListAll (0.00s)
		users_test.go:166: Users.Get returned error: GET http://127.0.0.1:59907/users?page=2&since=1: 500  []
		users_test.go:171: Users.ListAll returned [], want [github.User{ID:2}]
	FAIL
	exit status 1
	FAIL	github.com/google/go-github/github	0.250s

Fixes #752.
Closes #753.
2017-10-13 16:17:37 -04:00
Dmitri Shuralyov 10a2b148cb Use relative URLs in all tests.
This does not change behavior, since these relative URLs are equivalent
to the previous absolute URLs. Tests continue to pass.

However, once #752 is resolved, absolute URLs will no longer work in
tests. So we need to change all absolute URLs to relative to keep tests
passing.

Helps #752.
2017-10-13 15:21:05 -04:00