Http.Get(AUrl).BeforeRequest(
procedure(AURL: string; Stream: TStream; Headers: TNetHeaders)
begin
// Перед запросом
end).AfterRequest(
procedure(ARatry: boolean; HTTPResponse: IHTTPResponse)
var
JsonObject: TJSONObject;
csrfToken: string;
begin
JsonObject := TJSONObject.ParseJSONValue(HTTPResponse.ContentAsString(TEncoding.UTF8)) as TJSONObject;
if JsonObject.TryGetValue('csrfToken', csrfToken) then
begin
// После выполнения запроса
// ARatry = true - если нам нужно повторить запрос
ARatry := true
end;
end).Success(
procedure(Content: string)
begin
// Ответ сервера status code 200
end);
Что значит нежелательной?
Класс App\Entity\User наследуется от Symfony\Component\Security\Core\User\User?
{
"code": 1,
"msg": "There is no user provider for user \"App\\Entity\\User\".",
"request": {
"http_method": "POST",
"request_method": "/services.add",
"parameters": {
"service_id": 26,
"expand": false,
"items": [
"A",
"B",
"C",
"D"
]
},
"stack_trace": [
{
"file": "/www/vendor/symfony/security-http/Firewall/ContextListener.php",
"line": 112,
"function": "refreshUser",
"class": "Symfony\\Component\\Security\\Http\\Firewall\\ContextListener",
"type": "->",
"args": [
{}
]
},
{
"file": "/www/vendor/symfony/security-bundle/Debug/WrappedListener.php",
"line": 51,
"function": "__invoke",
"class": "Symfony\\Component\\Security\\Http\\Firewall\\ContextListener",
"type": "->",
"args": [
{}
]
},
{
"file": "/www/vendor/symfony/security-bundle/Debug/TraceableFirewallListener.php",
"line": 35,
"function": "__invoke",
"class": "Symfony\\Bundle\\SecurityBundle\\Debug\\WrappedListener",
"type": "->",
"args": [
{}
]
},
{
"file": "/www/vendor/symfony/security-http/Firewall.php",
"line": 97,
"function": "callListeners",
"class": "Symfony\\Bundle\\SecurityBundle\\Debug\\TraceableFirewallListener",
"type": "->",
"args": [
{},
{}
]
},
{
"file": "/www/vendor/symfony/event-dispatcher/Debug/WrappedListener.php",
"line": 126,
"function": "onKernelRequest",
"class": "Symfony\\Component\\Security\\Http\\Firewall",
"type": "->",
"args": [
{},
"kernel.request",
{}
]
},
{
"file": "/www/vendor/symfony/event-dispatcher/EventDispatcher.php",
"line": 260,
"function": "__invoke",
"class": "Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener",
"type": "->",
"args": [
{},
"kernel.request",
{}
]
},
{
"file": "/www/vendor/symfony/event-dispatcher/EventDispatcher.php",
"line": 235,
"function": "doDispatch",
"class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
"type": "->",
"args": [
[
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{}
],
"kernel.request",
{}
]
},
{
"file": "/www/vendor/symfony/event-dispatcher/EventDispatcher.php",
"line": 73,
"function": "callListeners",
"class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
"type": "->",
"args": [
[
{},
{},
{},
{},
{},
{},
{},
{},
{},
{},
{}
],
"kernel.request",
{}
]
},
{
"file": "/www/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php",
"line": 168,
"function": "dispatch",
"class": "Symfony\\Component\\EventDispatcher\\EventDispatcher",
"type": "->",
"args": [
{},
"kernel.request"
]
},
{
"file": "/www/vendor/symfony/http-kernel/HttpKernel.php",
"line": 127,
"function": "dispatch",
"class": "Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcher",
"type": "->",
"args": [
{},
"kernel.request"
]
},
{
"file": "/www/vendor/symfony/http-kernel/HttpKernel.php",
"line": 68,
"function": "handleRaw",
"class": "Symfony\\Component\\HttpKernel\\HttpKernel",
"type": "->",
"args": [
{
"attributes": {},
"request": {},
"query": {},
"server": {},
"files": {},
"cookies": {},
"headers": {}
},
1
]
},
{
"file": "/www/vendor/symfony/http-kernel/Kernel.php",
"line": 198,
"function": "handle",
"class": "Symfony\\Component\\HttpKernel\\HttpKernel",
"type": "->",
"args": [
{
"attributes": {},
"request": {},
"query": {},
"server": {},
"files": {},
"cookies": {},
"headers": {}
},
1,
true
]
},
{
"file": "/www/public/admin.php",
"line": 30,
"function": "handle",
"class": "Symfony\\Component\\HttpKernel\\Kernel",
"type": "->",
"args": [
{
"attributes": {},
"request": {},
"query": {},
"server": {},
"files": {},
"cookies": {},
"headers": {}
}
]
}
]
}
}
Вот эту ошибку я не жду
[[2019-11-13 17:49:47] request.INFO: Matched route "app_admin_services_add". {"route":"app_admin_services_add","route_parameters":{"_route":"app_admin_services_add","_controller":"App\\Controller\\Admin\\ServicesController::add"},"request_uri":"http://127.0.0.150:8091/services.add","method":"POST"} []
[2019-11-13 17:49:47] security.DEBUG: Read existing security token from the session. {"key":"_security_main","token_class":"Symfony\\Component\\Security\\Guard\\Token\\PostAuthenticationGuardToken"} []
[2019-11-13 17:49:48] php.CRITICAL: Uncaught Exception: There is no user provider for user "App\Entity\User". {"exception":"[object] (RuntimeException(code: 0): There is no user provider for user \"App\\Entity\\User\". at /www/vendor/symfony/security-http/Firewall/ContextListener.php:241)"} []
Я ожидаю эту ошибку
[2019-11-13 17:49:51] request.INFO: Matched route "app_admin_services_add". {"route":"app_admin_services_add","route_parameters":{"_route":"app_admin_services_add","_controller":"App\\Controller\\Admin\\ServicesController::add"},"request_uri":"http://127.0.0.150:8091/services.add","method":"POST"} []
[2019-11-13 17:49:51] security.DEBUG: Checking for guard authentication credentials. {"firewall_key":"main","authenticators":1} []
[2019-11-13 17:49:51] security.DEBUG: Checking support on guard authenticator. {"firewall_key":"main","authenticator":"App\\Security\\TokenAuthenticator"} []
[2019-11-13 17:49:51] security.DEBUG: Calling getCredentials() on guard authenticator. {"firewall_key":"main","authenticator":"App\\Security\\TokenAuthenticator"} []
[2019-11-13 17:49:51] security.DEBUG: Passing guard token information to the GuardAuthenticationProvider {"firewall_key":"main","authenticator":"App\\Security\\TokenAuthenticator"} []
[2019-11-13 17:49:51] security.INFO: Guard authentication successful! {"token":"[object] (Symfony\\Component\\Security\\Guard\\Token\\PostAuthenticationGuardToken: PostAuthenticationGuardToken(user=\"\", authenticated=true, roles=\"ROLE_USER\"))","authenticator":"App\\Security\\TokenAuthenticator"} []
[2019-11-13 17:49:52] security.DEBUG: Guard authenticator set no success response: request continues. {"authenticator":"App\\Security\\TokenAuthenticator"} []
[2019-11-13 17:49:52] security.DEBUG: Remember me skipped: it is not configured for the firewall. {"authenticator":"App\\Security\\TokenAuthenticator"} []
[2019-11-13 17:49:54] php.CRITICAL: Uncaught Exception: An exception occurred while executing 'INSERT INTO services (name, altName, lft, lvl, rgt, root_id, parent_id) VALUES (?, ?, ?, ?, ?, ?, ?)' with params ["A", null, 0, 0, 0, null, 26]: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'A-26' for key 'services_unique_name_parent_id' {"exception":"[object] (Doctrine\\DBAL\\Exception\\UniqueConstraintViolationException(code: 0): An exception occurred while executing 'INSERT INTO services (name, altName, lft, lvl, rgt, root_id, parent_id) VALUES (?, ?, ?, ?, ?, ?, ?)' with params [\"A\", null, 0, 0, 0, null, 26]:\n\nSQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'A-26' for key 'services_unique_name_parent_id' at /www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php:55, Doctrine\\DBAL\\Driver\\PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'A-26' for key 'services_unique_name_parent_id' at /www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:119, PDOException(code: 23000): SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'A-26' for key 'services_unique_name_parent_id' at /www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:117)"} []
[2019-11-13 17:49:54] security.DEBUG: Stored the security token in the session. {"key":"_security_main"} []