Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Certes.Acme.Resource.Challenge error property #102

Merged
merged 3 commits into from
May 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
### Added
- Export full chain certification in PEM ([#87][i87])
- Support custom `HttpClient` ([#95][i95])
- Add `Challenge.Error` for challenge valdidation error ([#99][i99])

### Changed
- Encapsulating ACME errors in exceptions ([#65][i65])
Expand Down Expand Up @@ -68,3 +69,4 @@ All notable changes to this project will be documented in this file.
[i86]: https://github.com/fszlin/certes/issues/86
[i87]: https://github.com/fszlin/certes/issues/87
[i95]: https://github.com/fszlin/certes/issues/95
[i99]: https://github.com/fszlin/certes/issues/99
11 changes: 11 additions & 0 deletions src/Certes/Acme/Resource/Challenge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,24 @@ public class Challenge
[JsonProperty("validated")]
public DateTimeOffset? Validated { get; set; }

/// <summary>
/// Gets or sets the error.
/// Only if the status is invalid
/// </summary>
/// <value>
/// The errors.
/// </value>
[JsonProperty("error")]
public AcmeError Error { get; set; }

/// <summary>
/// Gets or sets the errors.
/// </summary>
/// <value>
/// The errors.
/// </value>
[JsonProperty("errors")]
[Obsolete("Use Challenge.Error instead.")]
public IList<object> Errors { get; set; }

/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions test/Certes.Tests/Acme/Resource/ChallengeTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using Certes.Acme;
using Certes.Acme.Resource;
using Xunit;

Expand All @@ -11,6 +12,7 @@ public void CanGetSetProperties()
{
var entity = new Challenge();
entity.VerifyGetterSetter(e => e.Errors, new object[0]);
entity.VerifyGetterSetter(e => e.Error, new AcmeError());
entity.VerifyGetterSetter(e => e.Status, ChallengeStatus.Invalid);
entity.VerifyGetterSetter(e => e.Token, "certes");
entity.VerifyGetterSetter(e => e.Type, "http-01");
Expand Down