38 Commits

Author SHA1 Message Date
Tom Longhurst
cd1835326b Fix xUnit Warnings (#2906)
* Fix xUnit Warnings

* Fix

* Fix formatting in AsyncPaginationExtensionGenerator.cs

---------

Co-authored-by: Keegan Campbell <me@kfcampbell.com>
2024-04-15 13:19:26 -07:00
Chris Simpson
bc156af4e6 maint: Fixing the use of the binary formatter in net461 so all unit tests now pass. (#2535) 2022-08-09 09:04:06 -05:00
Chris Simpson
651d9818c7 ci(build): Fixes a number of warnings for a cleaner build (#2529)
* Fixing a number of warnings for a cleaner build

* Removing extra Summary slashes
2022-08-08 10:20:37 -05:00
Diogo Rolo
4f4ef5ba73 Fix null reference access when ContentType is null (#2501) 2022-07-21 16:36:02 -05:00
Fredrik Høisæther Rasch
af74ae8e20 Add Server Time Difference to ApiInfo (#2196) 2020-06-07 18:25:34 -03:00
Brendan Forster
287861e4a7 rewrite the setup of responses to use a standard helper function (#2177) 2020-04-14 11:30:15 -03:00
Brendan Forster
8d7bda96e4 handle case insensitive headers when parsing for API rate limiting (#2175) 2020-04-12 13:04:30 -03:00
Mickaël Derriey
13d5dab516 Port to .NET Core (#1503)
Port to .NET Core
2017-01-21 14:42:02 +10:00
Sean Killeen
4cec3a6532 Introduce AbuseException (#1528)
* Add some tests to be completed

* Actually fail the tests

* Create AbuseException class

Copied from ForbiddenException and then gone over to inherit from it.

* Actually add AbuseException to csproj

* Update test file

* Ran .\build FixProjects

* Test updates

* Default message update for AbuseException

* Separate the exception creation logic

* Remove message assertion -- doesn't matter here

* Additional test for abuse message

* Remove unnecessary variable assignment

* Failing test for unsafe request

* Attempt to fix test

Still broken -- I don't think empty strings count to trigger the default
message

* Remove test that will always fail due to another issue

Opened #1529 to explore this.

* New tests (some failing)

* Passing tests are, like, better than failing tests.

* Last passing test

* Cleanup

* Add test for zero value and fix code

Lol boundary cases.

* cleanup

* Mark ParseRetryAfterSeconds as static

* Add GetObjectData override to AbuseException

To include data for RetryAfterSeconds variable, and satisfy the build
check.

* Add back failing test & skip it

* Change to nullable int with null default

* Fix tests around nullable default

* whitespace fixes

* Compact the logic; tests still pass

* Invert the if statements for compactness / clarity

* Test subclasses & reformatting

* Test name changes

* Whitespace fix

* Remove redundant line
2017-01-12 07:30:43 +10:00
aedampir@gmail.com
d0c8e82453 Red Tests were fixed
Unused 'using' directive were removed.
2016-04-18 12:46:13 +07:00
Devesh Khandelwal
cdd46465db Add custom exception for the HTTP 451 response (#1239)
* Add HTTP 451: Legal Takedown Exception.

* Add LegalRestrictionException in HandleErrors.

* Cast 451 to HttpStatusCode and include exception in csproj files.

* Tests added and "FixProjects".

* Fix: 403 -> 451 in 451Tests.
2016-04-10 14:07:18 -04:00
aedampir@gmail.com
7e4e874f19 Misspelling Attepmts -> Attempts was fixed. 2016-03-23 22:30:24 +07:00
Brendan Forster
6bedf1ee9b just a bit of code cleanup 2016-02-02 10:01:16 +10:30
Anton Sizikov
a7e06c7cd0 Removed custom message format and just print raw body 2015-12-08 10:10:59 +01:00
Anton Sizikov
3f8ed4a882 Unit test fixed 2015-12-06 19:37:11 +01:00
Anton Sizikov
5ef499686e Overrided ToString methods for ApiException and ApiError 2015-12-06 19:34:32 +01:00
Brendan Forster
80719c0033 aaaand format the code 2015-11-04 13:38:51 -08:00
Brendan Forster
47c0540165 Merge pull request #662 from octokit/haacked/api-response-refactor
Make the response objects readonly.
2015-01-28 09:31:27 +10:30
Gabriel Weyer
1b1a397a09 RepositoryExistsException has now two constructors (one for account and one for organization) 2015-01-08 17:09:08 +11:00
Haacked
4653e798a7 Make Response.StatusCode readonly 2015-01-04 19:15:42 -08:00
Haacked
89e8fdfeaf Make Response.Body readonly 2015-01-04 19:15:40 -08:00
Haacked
ff3506f3e8 Make some of the IResponse properties readonly 2015-01-04 19:13:32 -08:00
Haacked
be9f446df4 Move Response to its own file and Internal namespace
A class named "Response" could conflict with a lot of things.
2015-01-04 19:03:25 -08:00
Haacked
4c8bab20eb IApiResponse no longer inherits IResponse 2015-01-04 18:58:53 -08:00
Haacked
ba0a7673ec Make ApiError.Errors a readonly list
Also added a test for it.
2015-01-03 20:22:30 -08:00
Brendan Forster
74b6e93fae deprecated field which is no longer necessary 2014-04-30 13:35:12 +08:00
Brendan Forster
46afc41015 making some of the additional fields less wrong 2014-04-30 13:34:36 +08:00
Brendan Forster
31e9577599 added some more tests 2014-04-30 13:32:19 +08:00
Brendan Forster
ac89fe07da adjusting exception message to not rely on credentials 2014-04-30 13:25:14 +08:00
Haacked
14ad942ea8 RateLimit class encapsulates rate limit headers
Added a RateLimit class to encapsulate pulling rate limit information
from the headers. This is now exposed by ApiInfo as well as the
RateLimitExceeededException. That way these two classes are not grabbing
the same information in different ways which we were doing before.
2013-10-18 14:49:00 -07:00
Haacked
f9089784f9 Fixing up the defaults a bit 2013-10-18 11:33:21 -07:00
Haacked
c87944c884 Add default messages for custom exceptions
Right now, our exception messages come from the API response in most
cases. But if for any reason there isn't one, we supply a default. I
realized these messages might make it to people's logs so it might be
nice to spend time later making them even more useful.
2013-10-18 11:08:56 -07:00
Haacked
a1887837be Implement 403 exception handling
This implements exception handling for the various 403 cases based off
of the Octokit.rb implementation.
https://github.com/octokit/octokit.rb/blob/master/lib/octokit/error.rb

Fixes #85
2013-10-17 22:22:56 -07:00
Haacked
db2f805bc8 Support requests with HttpContent body
If a 3rd party client needs to provide a specific HttpContent, we should
allow that in the adapter. Our clients probably shouldn't do this as it
would break encapsulation.
2013-10-11 14:34:09 -07:00
Haacked
e98e46c728 Make ApiError is never null 2013-10-10 22:11:49 -07:00
half-ogre
6f3fa81789 move internal stuff to .Internal namespace 2013-10-08 15:14:06 -07:00
Haacked
b567097a38 Change RT unit tests assembly name 2013-10-02 16:33:39 -07:00
Haacked
a39a80cc88 Add exception handling for non-OK status codes 2013-10-02 16:17:36 -07:00