You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Joseh-Henrique edited this page Jun 10, 2022
·
2 revisions
objetivo
Retornar para o Client outro StatusCode para um ServerEvent ou ServerContext, diferente de 200 (de Ok).
Exemplo: ocorreu um erro e é necessário retornar um código de erro, como 500 (de Internal Server Error) ou 503 (de Service Unavailable).
uso
Em um evento OnReplyEvent de um Evento de um DWServerEvents, ou OnReplyRequest de um Evento de um DWServerContext:
// retornar um novo DWParam com nome 'StatusCode' var cStatusCode: TJSONParam;
cStatusCode := TJSONParam.Create(esUtf8);
cStatusCode.ParamName := 'StatusCode';
cStatusCode.ObjectDirection := odOUT;
cStatusCode.ObjectValue := ovInteger;
cStatusCode.Value := 503; // Service Unavailable
Params.Add(cStatusCode);