116 references to PostAsJsonAsync
Microsoft.AspNetCore.Identity.FunctionalTests (114)
MapIdentityApiTests.cs (114)
46AssertOkAndEmpty(await client.PostAsJsonAsync("/identity/register", new { Email, Password })); 55AssertBadRequestAndEmpty(await client.PostAsJsonAsync("/identity/register", new { Password })); 65await AssertValidationProblemAsync(await client.PostAsJsonAsync("/identity/register", new { Email = "invalid", Password }), 76AssertOkAndEmpty(await client.PostAsJsonAsync("/identity/register", new { Email, Password })); 77await AssertValidationProblemAsync(await client.PostAsJsonAsync("/identity/register", new { Email, Password }), 87await AssertProblemAsync(await client.PostAsJsonAsync("/identity/login", new { Email, Password }), 98await AssertProblemAsync(await client.PostAsJsonAsync("/identity/login", new { Email, Password = "wrong" }), 110var loginResponse = await client.PostAsJsonAsync("/identity/login", new { Email, Password }); 143var loginResponse = await client.PostAsJsonAsync("/identity/login", new { Email, Password }); 180var loginResponse = await client.PostAsJsonAsync("/identity/login", new { Email, Password }); 211var loginResponse = await client.PostAsJsonAsync("/identity/login?useCookies=true", new { Email, Password }); 236=> client.PostAsJsonAsync("/identity/login?useCookies=true", new { Email, Password })); 259var loginResponse = await client.PostAsJsonAsync("/identity/login", new { Email, Password }); 295var loginResponse = await client.PostAsJsonAsync("/identity/login", new { Email, Password }); 299var refreshResponse = await client.PostAsJsonAsync("/identity/refresh", new { refreshToken }); 314AssertUnauthorizedAndEmpty(await client.PostAsJsonAsync("/identity/refresh", new { refreshToken })); 317AssertUnauthorizedAndEmpty(await client.PostAsJsonAsync("/identity/refresh", new { refreshToken })); 340var loginResponse = await client.PostAsJsonAsync("/identity/login", new { Email, Password }); 347var refreshResponse = await client.PostAsJsonAsync("/identity/refresh", new { refreshToken }); 353refreshResponse = await client.PostAsJsonAsync("/identity/refresh", new { refreshToken }); 363AssertUnauthorizedAndEmpty(await client.PostAsJsonAsync("/identity/refresh", new { refreshToken })); 369refreshResponse = await client.PostAsJsonAsync("/identity/refresh", new { refreshToken }); 393AssertUnauthorizedAndEmpty(await client.PostAsJsonAsync("/identity/refresh", new { refreshToken })); 414var refreshResponse = await client.PostAsJsonAsync("/identity/refresh", new { refreshToken }); 437await AssertProblemAsync(await client.PostAsJsonAsync("/identity/login", new { Email, Password = "wrong" }), 440await AssertProblemAsync(await client.PostAsJsonAsync("/identity/login", new { Email, Password = "wrong" }), 447await AssertProblemAsync(await client.PostAsJsonAsync("/identity/login", new { Email, Password }), 467await AssertProblemAsync(await client.PostAsJsonAsync("/identity/login", new { Email, Password = "wrong" }), 474AssertOk(await client.PostAsJsonAsync("/identity/login", new { Email, Password })); 549await AssertProblemAsync(await client.PostAsJsonAsync("/identity/login", new { Email, Password }), 552AssertOk(await client.PostAsJsonAsync("/identity/resendConfirmationEmail", new { Email = "wrong" })); 553AssertOk(await client.PostAsJsonAsync("/identity/resendConfirmationEmail", new { Email = Email })); 562AssertOk(await client.PostAsJsonAsync("/identity/login", new { Email, Password })); 670var loginResponse = await client.PostAsJsonAsync("/identity/login", new { Email, Password }); 681await AssertValidationProblemAsync(await client.PostAsJsonAsync("/identity/manage/2fa", new { Enable = true }), 683await AssertValidationProblemAsync(await client.PostAsJsonAsync("/identity/manage/2fa", new { Enable = true, TwoFactorCode = "wrong" }), 688AssertBadRequestAndEmpty(await client.PostAsJsonAsync<object?>("/identity/manage/2fa", null)); 690var twoFactorKeyResponse = await client.PostAsJsonAsync("/identity/manage/2fa", new object()); 702var enable2faResponse = await client.PostAsJsonAsync("/identity/manage/2fa", new { twoFactorCode, Enable = true }); 711AssertUnauthorizedAndEmpty(await client.PostAsJsonAsync("/identity/refresh", new { refreshToken })); 715await AssertProblemAsync(await client.PostAsJsonAsync("/identity/login", new { Email, Password }), 718AssertOk(await client.PostAsJsonAsync("/identity/login", new { Email, Password, twoFactorCode })); 728var loginResponse = await client.PostAsJsonAsync("/identity/login", new { Email, Password }); 734var twoFactorKeyResponse = await client.PostAsJsonAsync("/identity/manage/2fa", new object()); 743var enable2faResponse = await client.PostAsJsonAsync("/identity/manage/2fa", new { twoFactorCode, Enable = true }); 752await AssertProblemAsync(await client.PostAsJsonAsync("/identity/login", new { Email, Password }), 755var recoveryLoginResponse = await client.PostAsJsonAsync("/identity/login", new { Email, Password, TwoFactorRecoveryCode = recoveryCodes[0] }); 763var disable2faResponse = await client.PostAsJsonAsync("/identity/manage/2fa", new { Enable = false }); 769AssertOk(await client.PostAsJsonAsync("/identity/login", new { Email, Password })); 780var loginResponse = await client.PostAsJsonAsync("/identity/login", new { Email, Password }); 786var twoFactorKeyResponse = await client.PostAsJsonAsync("/identity/manage/2fa", new object()); 795await AssertValidationProblemAsync(await client.PostAsJsonAsync("/identity/manage/2fa", new { twoFactorCode, Enable = true, ResetSharedKey = true }), 798var enable2faResponse = await client.PostAsJsonAsync("/identity/manage/2fa", new { twoFactorCode, Enable = true }); 802var resetKeyResponse = await client.PostAsJsonAsync("/identity/manage/2fa", new { ResetSharedKey = true }); 812await AssertValidationProblemAsync(await client.PostAsJsonAsync("/identity/manage/2fa", new { twoFactorCode, Enable = true }), 815var reenable2faResponse = await client.PostAsJsonAsync("/identity/manage/2fa", new { TwoFactorCode = resetTwoFactorCode, Enable = true }); 827var loginResponse = await client.PostAsJsonAsync("/identity/login", new { Email, Password }); 833var twoFactorKeyResponse = await client.PostAsJsonAsync("/identity/manage/2fa", new object()); 842var enable2faResponse = await client.PostAsJsonAsync("/identity/manage/2fa", new { twoFactorCode, Enable = true }); 850await AssertProblemAsync(await client.PostAsJsonAsync("/identity/login", new { Email, Password }), 853AssertOk(await client.PostAsJsonAsync("/identity/login", new { Email, Password, TwoFactorRecoveryCode = recoveryCodes[0] })); 855await AssertProblemAsync(await client.PostAsJsonAsync("/identity/login", new { Email, Password, TwoFactorRecoveryCode = recoveryCodes[0] }), 858var recoveryLoginResponse = await client.PostAsJsonAsync("/identity/login", new { Email, Password, TwoFactorRecoveryCode = recoveryCodes[1] }); 865var updated2faResponse = await client.PostAsJsonAsync("/identity/manage/2fa", new object()); 870await AssertValidationProblemAsync(await client.PostAsJsonAsync("/identity/manage/2fa", new { twoFactorCode, Enable = true, ResetSharedKey = true }), 873var resetRecoveryResponse = await client.PostAsJsonAsync("/identity/manage/2fa", new { ResetRecoveryCodes = true }); 882AssertOk(await client.PostAsJsonAsync("/identity/login", new { Email, Password, TwoFactorRecoveryCode = resetRecoveryCodes[0] })); 885await AssertProblemAsync(await client.PostAsJsonAsync("/identity/login", new { Email, Password, TwoFactorRecoveryCode = recoveryCodes[2] }), 896var loginResponse = await client.PostAsJsonAsync("/identity/login?useCookies=true", new { Email, Password }); 899var twoFactorKeyResponse = await client.PostAsJsonAsync("/identity/manage/2fa", new object()); 911var enable2faResponse = await client.PostAsJsonAsync("/identity/manage/2fa", new { twoFactorCode, Enable = true }); 916await AssertProblemAsync(await client.PostAsJsonAsync("/identity/login", new { Email, Password }), 920var sessionLoginResponse = await client.PostAsJsonAsync("/identity/login?useSessionCookies=true", new { Email, Password, twoFactorCode }); 923var session2faResponse = await client.PostAsJsonAsync("/identity/manage/2fa", new object()); 929var sessionLoginResponse2 = await client.PostAsJsonAsync("/identity/login?useCookies=true&useSessionCookies=true", new { Email, Password, twoFactorCode }); 932var session2faResponse2 = await client.PostAsJsonAsync("/identity/manage/2fa", new object()); 938var persistentLoginResponse = await client.PostAsJsonAsync("/identity/login?useCookies=true", new { Email, Password, twoFactorCode }); 941var persistent2faResponse = await client.PostAsJsonAsync("/identity/manage/2fa", new object()); 975AssertOkAndEmpty(await client.PostAsJsonAsync("/identity/forgotPassword", new { Email = confirmedEmail })); 976AssertOkAndEmpty(await client.PostAsJsonAsync("/identity/forgotPassword", new { Email = unconfirmedEmail })); 977AssertOkAndEmpty(await client.PostAsJsonAsync("/identity/forgotPassword", new { Email = "wrong" })); 990AssertBadRequestAndEmpty(await client.PostAsJsonAsync("/identity/resetPassword", new { Email = confirmedEmail, resetCode })); 991AssertBadRequestAndEmpty(await client.PostAsJsonAsync("/identity/resetPassword", new { Email = unconfirmedEmail, resetCode })); 992AssertBadRequestAndEmpty(await client.PostAsJsonAsync("/identity/resetPassword", new { Email = "wrong", resetCode })); 994await AssertValidationProblemAsync(await client.PostAsJsonAsync("/identity/resetPassword", new { Email = confirmedEmail, ResetCode = "wrong", newPassword }), 996await AssertValidationProblemAsync(await client.PostAsJsonAsync("/identity/resetPassword", new { Email = unconfirmedEmail, ResetCode = "wrong", newPassword }), 998await AssertValidationProblemAsync(await client.PostAsJsonAsync("/identity/resetPassword", new { Email = "wrong", ResetCode = "wrong", newPassword }), 1002await AssertValidationProblemAsync(await client.PostAsJsonAsync("/identity/resetPassword", new { Email = confirmedEmail, ResetCode = "wrong", NewPassword = "" }), 1004await AssertProblemAsync(await client.PostAsJsonAsync("/identity/resetPassword", new { Email = confirmedEmail, resetCode, NewPassword = "" }), 1007AssertOkAndEmpty(await client.PostAsJsonAsync("/identity/resetPassword", new { Email = confirmedEmail, resetCode, newPassword })); 1010await AssertProblemAsync(await client.PostAsJsonAsync("/identity/login", new { Email = confirmedEmail, Password }), 1014AssertOk(await client.PostAsJsonAsync("/identity/login", new { Email = confirmedEmail, Password = newPassword })); 1052await AssertValidationProblemAsync(await client.PostAsJsonAsync("/identity/manage/info", new { NewEmail = "invalid" }), 1055var infoPostResponse = await client.PostAsJsonAsync("/identity/manage/info", new { newEmail }); 1068await AssertProblemAsync(await client.PostAsJsonAsync("/identity/login", new { Email = newEmail, Password }), 1072AssertOk(await client.PostAsJsonAsync("/identity/refresh", new { RefreshToken = originalRefreshToken })); 1094AssertUnauthorizedAndEmpty(await client.PostAsJsonAsync("/identity/refresh", new { RefreshToken = originalRefreshToken })); 1132var loginResponse = await client.PostAsJsonAsync("/identity/login?useCookies=true", new { Email, Password }); 1146var infoPostResponse = await client.PostAsJsonAsync("/identity/manage/info", new { newEmail }); 1182var secondLoginResponse = await client.PostAsJsonAsync("/identity/login?useCookies=true", new { Email = newEmail, Password }); 1205await AssertValidationProblemAsync(await client.PostAsJsonAsync("/identity/manage/info", new { newPassword }), 1207AssertOk(await client.PostAsJsonAsync("/identity/manage/info", new { OldPassword = Password, newPassword })); 1212await AssertProblemAsync(await client.PostAsJsonAsync("/identity/login", new { Email, Password }), 1214AssertOk(await client.PostAsJsonAsync("/identity/login", new { Email, Password = newPassword })); 1240await AssertValidationProblemAsync(await client.PostAsJsonAsync("/identity/manage/info", new { newPassword, newEmail }), 1247var infoPostResponse = await client.PostAsJsonAsync("/identity/manage/info", new { OldPassword = Password, newPassword, newEmail }); 1255await AssertProblemAsync(await client.PostAsJsonAsync("/identity/login", new { Email = newEmail, Password = newPassword }), 1258await AssertProblemAsync(await client.PostAsJsonAsync("/identity/login", new { Email, Password }), 1261AssertOk(await client.PostAsJsonAsync("/identity/login", new { Email, Password = newPassword })); 1274AssertOk(await client.PostAsJsonAsync("/identity/login", new { Email = newEmail, Password = newPassword })); 1385AssertOkAndEmpty(await client.PostAsJsonAsync($"{groupPrefix}/register", new { email, Password })); 1393await client.PostAsJsonAsync($"{groupPrefix}/login", new { email, Password }); 1394var loginResponse = await client.PostAsJsonAsync("/identity/login", new { email, Password }); 1415await AssertProblemAsync(await client.PostAsJsonAsync($"{groupPrefix}/login", new { email, Password }),
Microsoft.AspNetCore.Routing.FunctionalTests (1)
RouteHandlerTest.cs (1)
52var response = await client.PostAsJsonAsync("/EchoTodo/42", todo);
System.Net.Http.Json (1)
System\Net\Http\Json\HttpClientJsonExtensions.Post.cs (1)
43=> client.PostAsJsonAsync(requestUri, value, options: null, cancellationToken);