public void XHttpMethodOverrideHandler_Should_Change_Method_correctly( string method, string xHttpMethodValue, string expectedMethod) { // arrange var innerHandlder = new DummyInnerHandler(); var handler = (HttpMessageHandler) new XHttpMethodOverrideHandler() { InnerHandler = innerHandlder }; var request = new HttpRequestMessage(new HttpMethod(method), "http://localhost:12345/foo/bar"); request.Headers.Add(XHttpMethodOverrideHandler.XOVERRIDEHEADER, xHttpMethodValue); var invoker = new HttpMessageInvoker(handler); // act var result = invoker.SendAsync(request, new CancellationToken()); // assert Assert.Equal(expectedMethod, innerHandlder.Request.Method.Method); }
public void XHttpMethodOverrideHandler_Should_Change_Method_correctly( string method, string xHttpMethodValue, string expectedMethod) { // arrange var innerHandlder = new DummyInnerHandler(); var handler = (HttpMessageHandler) new XHttpMethodOverrideHandler() { InnerHandler = innerHandlder }; var request = new HttpRequestMessage(new HttpMethod(method), "http://localhost:12345/foo/bar"); request.Headers.Add(XHttpMethodOverrideHandler.XOVERRIDEHEADER, xHttpMethodValue); var invoker = new HttpMessageInvoker(handler); // act var result = invoker.SendAsync(request, new CancellationToken()); // assert Assert.Equal(expectedMethod, innerHandlder.Request.Method.Method); }