Skip to content

Commit

Permalink
Merge pull request #157 from OctopusDeploy/overalldash
Browse files Browse the repository at this point in the history
Overalldash
  • Loading branch information
zentron authored Apr 10, 2017
2 parents 3a687ed + 5683680 commit 9434847
Show file tree
Hide file tree
Showing 6 changed files with 4,024 additions and 3,999 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Octopus.Client
Octopus.Client.IOctopusClient
IDisposable
{
event Action<WebResponse> AfterReceivingHttpResponse
event Action<WebRequest> BeforeSendingHttpRequest
}
interface ILinkResolver
Expand Down Expand Up @@ -166,6 +167,7 @@ Octopus.Client
Octopus.Client.IOctopusAsyncClient
IDisposable
{
event Action<HttpResponseMessage> AfterReceivedHttpResponse
event Action<HttpRequestMessage> BeforeSendingHttpRequest
event Action<OctopusResponse> ReceivedOctopusResponse
event Action<OctopusRequest> SendingOctopusRequest
Expand Down Expand Up @@ -243,6 +245,7 @@ Octopus.Client
Octopus.Client.IOctopusClient
IDisposable
{
event Action<WebResponse> AfterReceivingHttpResponse
event Action<WebRequest> BeforeSendingHttpRequest
event Action<OctopusResponse> ReceivedOctopusResponse
event Action<OctopusRequest> SendingOctopusRequest
Expand Down Expand Up @@ -1888,6 +1891,7 @@ Octopus.Client.Model
Octopus.Client.Model.IAuditedResource
{
.ctor()
Boolean IsBrowserCachingEnabled { get; set; }
Boolean IsCommunityActionTemplatesEnabled { get; set; }
Boolean IsDockerEnabled { get; set; }
Boolean IsMultiTenancyEnabled { get; set; }
Expand Down
5 changes: 5 additions & 0 deletions source/Octopus.Client/IHttpOctopusClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ public interface IHttpOctopusClient : IOctopusClient
/// Occurs when a request is about to be sent.
/// </summary>
event Action<WebRequest> BeforeSendingHttpRequest;

/// <summary>
/// Occurs when a response has been recieved.
/// </summary>
event Action<WebResponse> AfterReceivingHttpResponse;
}
}
#endif
4 changes: 4 additions & 0 deletions source/Octopus.Client/Model/FeaturesConfigurationResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ public class FeaturesConfigurationResource : Resource

[Writeable]
public bool IsDockerEnabled { get; set; }

[Writeable]
public bool IsCommunityActionTemplatesEnabled { get; set; }

[Writeable]
public bool IsBrowserCachingEnabled { get; set; }
}
}
15 changes: 10 additions & 5 deletions source/Octopus.Client/OctopusAsyncClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ public async Task<RootResource> RefreshRootDocument()
/// </summary>
public event Action<HttpRequestMessage> BeforeSendingHttpRequest;

/// <summary>
/// Occurs when a response has been received.
/// </summary>
public event Action<HttpResponseMessage> AfterReceivedHttpResponse;

/// <summary>
/// Occurs when a request is about to be sent.
/// </summary>
Expand Down Expand Up @@ -527,22 +532,22 @@ protected virtual async Task<OctopusResponse<TResponseResource>> DispatchRequest
}
}

var requestHandler = SendingOctopusRequest;
requestHandler?.Invoke(request);
SendingOctopusRequest?.Invoke(request);

var webRequestHandler = BeforeSendingHttpRequest;
webRequestHandler?.Invoke(message);
BeforeSendingHttpRequest?.Invoke(message);

if (request.RequestResource != null)
message.Content = GetContent(request);

var completionOption = readResponse
? HttpCompletionOption.ResponseContentRead
: HttpCompletionOption.ResponseHeadersRead;
try
{
using (var response = await client.SendAsync(message, completionOption).ConfigureAwait(false))
{
AfterReceivedHttpResponse?.Invoke(response);

if (!response.IsSuccessStatusCode)
throw await OctopusExceptionFactory.CreateException(response).ConfigureAwait(false);

Expand Down
13 changes: 9 additions & 4 deletions source/Octopus.Client/OctopusClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ public RootResource RefreshRootDocument()
/// </summary>
public event Action<WebRequest> BeforeSendingHttpRequest;

/// <summary>
/// Occurs when a response has been received.
/// </summary>
public event Action<WebResponse> AfterReceivingHttpResponse;

/// <summary>
/// Occurs when a request is about to be sent.
/// </summary>
Expand Down Expand Up @@ -475,13 +480,12 @@ protected virtual OctopusResponse<TResponseResource> DispatchRequest<TResponseRe
}
}

var requestHandler = SendingOctopusRequest;
requestHandler?.Invoke(request);
SendingOctopusRequest?.Invoke(request);

var webRequestHandler = BeforeSendingHttpRequest;
webRequestHandler?.Invoke(webRequest);
BeforeSendingHttpRequest?.Invoke(webRequest);

HttpWebResponse webResponse = null;

try
{
if (request.RequestResource == null) {
Expand Down Expand Up @@ -532,6 +536,7 @@ protected virtual OctopusResponse<TResponseResource> DispatchRequest<TResponseRe
}

webResponse = (HttpWebResponse)webRequest.GetResponse();
AfterReceivingHttpResponse?.Invoke(webResponse);

var resource = default(TResponseResource);
if (readResponse)
Expand Down

0 comments on commit 9434847

Please sign in to comment.