Commit Graph

137 Commits

Author SHA1 Message Date
Martin Costello 4f826bc65b [fix] Fix handling for Streams in IConnection for raw content (#2791)
* Fix handling for Streams

Fix `NullReferenceException` if raw content was handled as a string rather than a stream by `HttpClientAdapter.BuildResponse()`.
Resolves #2789.

* Add Connection.GetRaw tests

Add tests for `Connection.GetRaw()` and for #2789.

---------

Co-authored-by: Keegan Campbell <me@kfcampbell.com>
2023-11-06 16:47:30 -08:00
Tom Longhurst 958bc5f1f8 [feat]: SDKs for ActionsArtifacts APIs 2023-09-25 14:16:41 -05:00
gitasaurus 3c82ff359c [FEAT] Adds support for enterprise audit logs 2023-05-09 10:28:58 -05:00
Yankai 66587ee0d1 [feat] Add Response caching 2023-02-07 11:35:54 -06:00
Chris Simpson 176bf386a0 maint: Tidying up DefineConstants (#2538) 2022-08-12 12:19:26 -05: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 2f7bd00dd6 feat: Removing accept header previews (#2515) 2022-08-01 09:37:23 -05:00
Tim Rogers 3d6cdc459f [MAINT] Tweak User-Agent to refer to Octokit.net, not just Octokit (#2447) 2022-07-11 09:04:44 -05:00
Chris Simpson b023602347 [FEAT] Adding in handling for secondary rate limit exceptions (#2473) 2022-07-11 09:03:31 -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
Brendan Forster 327020750f add convention test for preview APIs (#2154) 2020-03-18 08:52:50 -03:00
Brendan Forster aeb8d19f29 address new Travis build warning (#2017)
* make explicit that which previously was fine

* suppress build warning
2019-09-24 11:19:10 -03:00
Brendan Forster eb65e090ca next batch of test cleanup (#2004) 2019-09-20 10:41:04 -03:00
Brendan Forster 45bc5eced7 autofix tests based on feedback from xunit analyzers (#1997) 2019-09-16 19:46:40 -03:00
dependabot-preview[bot] 61bd1d1018 Bump NSubstitute from 3.1.0 to 4.2.1 (#1993)
* Bump NSubstitute from 3.1.0 to 4.2.1

Bumps NSubstitute from 3.1.0 to 4.2.1.

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* fix failing tests
2019-09-16 19:12:56 -03:00
Ryan Gribble db74c3b4ad Fix async tests (#1631)
* Fix up Assert.ThrowsAsync tests to actually await the call

* ... and it even picked up a missing null check... pay day!
2017-07-23 09:03:10 +10:00
Mickaël Derriey 9c80b00e6f Merge master into dotnetcore (#1599)
* bugfix - PUT should have a payload for Mark as Read (#1579)

* bugfix - PUT should have a payload for Mark as Read

* also fix the Observable client test

* add integration tests for MarkRead methods

* Fixup MarkReadForRepository methods to specify a body in the PUT request

* Fix unit tests for regular and observable client

* helps if the new files are included in the test project :)

* Cloning ApiInfo object should work when some fields are null (#1580)

* Adjust ApiInfo.Clone() to work even if some elements (eg ETag) are null

* Remove c# 6 language feature and do it the old school way

* Add a test for cloning ApiInfo when some fields are null

* The 3 lists can never be null anyway so remove some un-needed statements

* Add test for null RateLimit

* Remove Rx-Main dependency from samples
This resolves #1592 - LINQPad doesn't understand how to restore this unlisted package and it's not actually needed in the samples.

* Adding RemovedFromProject and other missing EventInfoState types. (#1591)

* Adding missing review types to event info.

* Fixing whitespace.

* Reword `BaseRefChanged` comment

* Adding missing event types.

* Change response models 'Url' properties from `Uri` to `string` (#1585)

* Add convention test to ensure 'Url' properties are of type string

Closes #1582

* Change 'Url' properties from Uri to string

Global Find/Replace FTW!

* fix compilation errors in the integration tests project

* Extend 'Url' properties type check to request models

* Stick to convention tests naming convention

* Remove unused using directives in models

Changing from `Uri` to `string` means the `using System;`
directive was not needed anymore in some files

* Update exception message wording

* empty commit to trigger a new build - hopefully Travis passes

* add convention test to ensure request models have Uri 'Url' properties

* make request models 'Url' properties Uri

fix typo in convention test name

* revert some request models 'Url' properties as `string`

see https://github.com/octokit/octokit.net/pull/1585#issuecomment-297186728

* Change test so that all model types must have 'Url' properties of type string

 - Filter test input to only get types which have 'Url' properties
 - Merge response and request model types tests into one
 - Unparameterize the exception since we only check for the string type now

* Fix string.Format tokens

If this PR doesn't get rebased, it'll be my wall of shame FOREVER!

* and then it's even more embarrassing when the commit message says rebased but you really meant squashed

* Remove exclusion of `Release` from request models
2017-05-02 21:55:30 +10:00
Mickaël Derriey 13d5dab516 Port to .NET Core (#1503)
Port to .NET Core
2017-01-21 14:42:02 +10:00
Ryan Gribble 3c818934b8 Release v0.24 - A Sight For Sore Eyes (#1539)
* Add release notes and bump version to 0.24

* run "build FormatCode" to fix up whitespace/formatting issues

* Fix failing Ssh key tests due to "validation exception".  This key must be in use on github (under another user, most likely from these tests failing).  Changed to a new SSH key and tweaked tests to reduce chance of a key being created and not destroyed

* Assignee and Assignees cant both be specified on NewIssue.  We missed this one in the PR.  Marked Assignee as [Obsolete] and fixed tests to use Assignees

* Fix a couple of Reactions tests that were calling the wrong client methods

* Fix timeline tests - looks like the response class has changed shape a bit, it now has an Issue object in the payload and Id field isnt present (leaving Id field there in case other timeline events do use it)

* Fix some following tests that require the test user to follow more than 1 other user

* Unskip these Event tests now because apparently they work!

* add breaking changes notes

* Update ApiErrorMessageSafe to return null for empty and whitespace strings (#1540)

* return null if ApiError.Message is empty or whitespace

* Uncomment test, which now passes

* update release notes to include PR1540

* Add "Bot" AccountType, was causing a deserialization exception when running the integration test "SearchForExcludedLanguage" (#1541)

* Update to include PR1541

* add bullets to make release notes easier to read

* markup additional code mentions in notes

* Fix grammar

fields => field
2017-01-17 18:56:55 +10:00
Sean Killeen 01a2d97212 Update ApiErrorMessageSafe to return null for empty and whitespace strings (#1540)
* return null if ApiError.Message is empty or whitespace

* Uncomment test, which now passes
2017-01-16 23:13:00 +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
Martin Scholz 5b9e23c2fb Fix timeout getting multiple repositories (#1411)
* add test

* [WIP]

* put logic for redirects outside of delegating handler

* change send method

* format code

* reorganized http client adapter

* change HttpClientAdapter

* rework http redirect tests - still an issue with accessing the response.RequestMessage.Content property as it is disposed

* remove some unused lines in httpclientadapter

* Reworked redirect implementation to fully clone http request and re-use it later
Now the skipped test from #874 works!
Also had to fix the new ReturnsRenamedRepository test as the ionide repo was renamed again
2016-08-15 06:57:50 +10:00
aedampir@gmail.com f1896888c6 Redundant commas in object initializer were removed. 2016-04-22 17:30:37 +07:00
Alexander Efremov db839f58d4 Redundant braces of argument list were removed (#1277) 2016-04-21 16:23:42 +10:00
aedampir@gmail.com fc644a0b1d ConnectionTests fixes 2016-03-29 17:38:39 +07:00
aedampir@gmail.com bad2ac18bf Merge branch 'master' of https://github.com/octokit/octokit.net into remove-redundant-commas 2016-03-25 00:55:55 +07:00
aedampir@gmail.com 7f5d446ea8 Redundant commas in object initializers were removed. 2016-03-24 23:12:12 +07:00
aedampir@gmail.com 79c38b4822 Redundant member initializer was removed.
Unused "using" directives were removed.
2016-03-23 12:23:30 +07:00
aedampir@gmail.com 6133210b97 Inconsistent modifiers declaration order was fixed. 2016-03-22 19:13:24 +07:00
Brendan Forster 2ed5999f08 Merge pull request #760 from octokit/api-paging-part-deux
Pagination Support
2016-03-14 15:50:25 +11:00
Devesh Khandelwal 534d54bb7f Verify Serialize is getting called with correct params. 2016-03-09 11:25:07 +05:30
Devesh Khandelwal 6e49068c8d Serialize object using mock serializer. Courtesy of @M-Zuber. 2016-03-08 14:59:46 +05:30
Brendan Forster c098ecda60 added overloads to IApiConnection which support passing in ApiOptions 2016-02-14 16:56:34 +11:00
Brendan Forster 51e56a86d7 some rogue Console.WriteLine in tests 2015-12-20 14:09:30 +10:30
Brendan Forster 80719c0033 aaaand format the code 2015-11-04 13:38:51 -08:00
Adam Ralph 4580e0f2a3 red: added ReadOnlyPagedCollectionTests.TheConstructor.AcceptsAResponseWithANullBody 2015-09-15 12:04:19 +02:00
Brendan Forster 82a3e7655c Merge pull request #862 from octokit/haacked/836-handle-empty-content
Handle empty content better
2015-09-10 11:34:09 +09:00
Mark Taylor b2c7e1c2a7 Chnage LastApiInfo to GetLastApiInfo with cloned version 2015-08-16 21:27:26 +01:00
Haacked 890f852c90 🎨 Refactor GetQueuedOperation to reduce duplication
Most calls to `GetQueuedOperation` are used to queue up an operation
that'll return a collection in a subsequent call. In the case that the
API returns No Content, we want to return an empty collection. This
refactoring embeds that last bit of logic into `GetQueuedOperation`
rather than making every caller have to do it.
2015-08-07 16:20:45 -07:00
Haacked 0e74097dde Handle NoContent response for queued operations
We didn't handle the 204 response properly for the `StatisticsClient`.
Now we do.

Fixes #836
2015-08-07 10:41:02 -07:00
Mark Taylor 40f1e59a97 Fixed merge conflicts 2015-08-02 16:40:10 +01:00
David Alpert b4d71c8fe9 refactoring ApiConnection.EmptyBody to RequestBody.Empty to break the inverse dependency from Connection to ApiConnection 2015-08-01 00:16:51 -05:00
David Alpert c54dfa196f adding passing tests: ConnectionTests.ThePutMethod can submit PUT requests with no data (i.e. empty body). 2015-07-31 23:49:48 -05:00
David Alpert ef8a6fe2cc refactoring ThePutMethod tests to clearly use the same body throughout 2015-07-31 23:47:48 -05:00
Kristian Hellang bc5a14a8af Fixed failing tests 2015-07-31 12:23:13 +02:00
Mark Taylor f8ee4f94a1 WIP checkin for getting last ApiInfo object 2015-07-31 10:35:51 +01:00
Phil Haack 5be1cae361 🎨 Really anal fix-ups of extra newlines
Not worth commenting on in a code review, so I fixed it myself.
2015-07-17 10:17:21 -07:00
Brendan Forster eafd63d768 oops, corrected the test 2015-06-05 16:57:27 +09:30