Beispiel #1
0
        public async Task Execute()
        {
            // non fluent
            var result = await _fluentHttpClient.Post <LoginResponse>("/api/auth/login", new
            {
                username = "******",
                password = "******"
            });

            // fluent
            LoginResponse fluentResult = await _fluentHttpClient.CreateRequest("/api/auth/login")
                                         .AsPost()
                                         .WithBody(new
            {
                username = "******",
                password = "******"
            })
                                         .Return <LoginResponse>();

            Check.That(result).IsNotNull();
            Check.That(result.AccessToken).IsNotNull();

            _sessionState.Set("auth:token", result.AccessToken);

            _logger.LogInformation("[{service}] complete", nameof(Auth_LoginTest));
        }
Beispiel #2
0
 public HomeEndpoint(ISessionState state)
 {
     _ss = state;
     _ss.Set<TODOList>("_theList",_theList);
 }