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
remove Apply() method
  • Loading branch information
annelo-msft committed Oct 27, 2021
commit e666c9d23793d00d1b62ed74fbc7aa0a1dfc0afb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ public virtual async Task<Response> GetPetAsync(string id, RequestContext contex
#pragma warning restore AZC0002
{
using HttpMessage message = CreateGetPetRequest(id, context);
message.Apply(context);
using var scope = _clientDiagnostics.CreateScope("PetStoreClient.GetPet");
scope.Start();
try
Expand Down Expand Up @@ -111,7 +110,6 @@ public virtual Response GetPet(string id, RequestContext context = null)
#pragma warning restore AZC0002
{
using HttpMessage message = CreateGetPetRequest(id, context);
message.Apply(context);
using var scope = _clientDiagnostics.CreateScope("PetStoreClient.GetPet");
scope.Start();
try
Expand Down
12 changes: 0 additions & 12 deletions sdk/core/Azure.Core/tests/HttpPipelineMessageTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,5 @@ public void ContentPropertyThrowsResponseIsExtracted()
Assert.AreSame(memoryStream, stream);
Assert.Throws<InvalidOperationException>(() => { var x = response.Content; });
}

[Test]
public void CanApplyRequestContext()
{
HttpMessage message = new HttpMessage(new MockRequest(), new ResponseClassifier());
RequestContext context = new RequestContext() { PerCallPolicy = new RequestContext.ActionPolicy(m => { }) };

message.Apply(context);

Assert.IsTrue(message.TryGetProperty("RequestContextPerCallPolicyCallback", out object policy));
Assert.AreEqual(typeof(RequestContext.ActionPolicy), policy.GetType());
}
}
}