public async Task should_return_200_for_unsigned_client_with_allowany_attribute() { HeimdallConfig.AllowPath("/api/any"); var unsignedClient = ClientFactory.CreateUnsignedClient(); var result = await unsignedClient.GetAsync("http://localhost:8080/api/any"); Assert.That(result.StatusCode, Is.EqualTo(HttpStatusCode.OK)); }
public static HttpSelfHostServer CreateServer(string url) { var config = new HttpSelfHostConfiguration(url); config.Routes.MapHttpRoute( name: "API Default", routeTemplate: "api/{controller}/{id}", constraints: null, defaults: new { id = RouteParameter.Optional }); var authenticateRequest = new AuthenticateRequest(new GetSecretFromUsername()); config.MessageHandlers.Add(new HmacAuthenticationHandler(authenticateRequest)); HeimdallConfig.EnableByPassWebApiCorsAndImplementOptions(yesOrNo: true); var server = new HttpSelfHostServer(config); server.OpenAsync().Wait(); return(server); }