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

Move RequestOptions and related types to Azure.Core #24945

Merged
merged 7 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
remove PerCallPolicy and Apply method
  • Loading branch information
annelo-msft committed Oct 27, 2021
commit 5b6cbf8d9492adb42aedcc8c2aa57f799282a9f2
17 changes: 0 additions & 17 deletions sdk/core/Azure.Core/src/HttpMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,23 +123,6 @@ public void SetProperty(string name, object value)
}
}

/// <summary>
/// Applies options from <see cref="RequestContext"/> instance to a <see cref="HttpMessage"/>.
/// </summary>
/// <param name="RequestContext"></param>
public void Apply(RequestContext RequestContext)
{
if (RequestContext == null)
{
return;
}

if (RequestContext.PerCallPolicy != null)
{
SetProperty("RequestContextPerCallPolicyCallback", RequestContext.PerCallPolicy);
}
}

/// <summary>
/// Disposes the request and response.
/// </summary>
Expand Down
18 changes: 0 additions & 18 deletions sdk/core/Azure.Core/src/RequestContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,5 @@ public RequestContext()
/// Controls under what conditions the operation raises an exception if the underlying response indicates a failure.
/// </summary>
public ErrorOptions ErrorOptions { get; set; } = ErrorOptions.Default;

/// <summary>
/// A <see cref="HttpPipelinePolicy"/> to use as part of this operation. This policy will be applied at the start
/// of the underlying <see cref="HttpPipeline"/>.
/// </summary>
internal HttpPipelinePolicy? PerCallPolicy { get; set; }

/// <summary>
/// An <see cref="HttpPipelineSynchronousPolicy"/> which invokes an action when a request is being sent.
/// </summary>
internal class ActionPolicy : HttpPipelineSynchronousPolicy
{
private Action<HttpMessage> Action { get; }

public ActionPolicy(Action<HttpMessage> action) => Action = action;

public override void OnSendingRequest(HttpMessage message) => Action.Invoke(message);
}
}
}