Delphi Can

Orjinalini görmek için tıklayınız: Rest Server Hata
Şu anda (Arşiv) modunu görüntülemektesiniz. Orjinal Sürümü Görüntüle internal link
Merhaba 
Aşağıdaki kodda client Token isteği (kullanıcı adını hatalı) gönderdiğinde önce (debug yaptığımda) Kullanıcı Hatalı [1] yazan yerden dönüyor, sonra bu procedure tekrar giriyor ve Yetkilendirme problemi [1] (tek mesaj) dönüyor.
2 defa istek gönderilmediği halde bu procedure neden 2. defa giriyor?

procedure Ttyp.typTokenAction(Sender: TObject; Request: TWebRequest;
 Response: TWebResponse; var Handled: Boolean);
var
 .....
begin
 Handled := True;
  case Request.MethodType of
  mtPost: begin
           AuthHeader := Request.Authorization;
           if AuthHeader.StartsWith('Basic ') then
               begin
                 AuthHeader := AuthHeader.Substring(6);
                 AuthInfo := TStringList.Create;
                 try
                   AuthInfo.Delimiter := ':';
                   AuthInfo.DelimitedText := TNetEncoding.Base64.Decode(AuthHeader);
                   if AuthInfo.Count = 2 then
                   begin
                     Username := AuthInfo[0];
                     Password := AuthInfo[1];
                   end
                    else
                   begin
                     Response.Content    := sdbf.JSonHata(803, 'Hatalı Başlık','');
                     Response.StatusCode := 400; // Bad Request
                   end;
                 finally
                   AuthInfo.Free;
                 end;
               end
                else
               begin
                 Response.Content    := sdbf.JSonHata(805, 'Yetkilendirme problemi [1]','');
                 Response.StatusCode := 401; // Unauthorized
                 exit;
               end;
           if (Username<>'TestUser') then
               begin
                 Response.Content := sdbf.JSonHata(805, 'Yetkilendirme problemi [2]', '');
                 Response.StatusCode := 401; // Unauthorized
                 Response.SendResponse;
                 exit;
               end else inc(KontSay);
           if (Password<>RestUrunSf) then
               begin
                 Response.Content := sdbf.JSonHata(805, 'Yetkilendirme problemi [3]', '');
                 Response.StatusCode := 401; // Unauthorized
                 Response.SendResponse;
                 exit;
               end else inc(KontSay);
           if not sdbf.SqlConnAc then
              begin
               Response.ContentType := 'application/json';
               Response.Content     := sdbf.JSonHata(801, '801.SQL Bağlantı Hatası', '');
               Response.StatusCode  := 400;
               Response.SendResponse;
               exit;
              end;
           // **** Kullanıcı
           try Pers   := TNetEncoding.URL.Decode(Request.GetFieldByName('Pers')); except Pers := ''; end;
           if  (Length(Pers)>20) or (string(Pers).CountChar('''')>0) then
               begin
                 Response.Content := sdbf.JSonHata(802, 'Kullanıcı Hatalı [0]', '');
                 Response.StatusCode := 401; // Unauthorized
                 Response.SendResponse;
                 exit;
               end;
           sdbf.QTMP('SELECT PERS.SIRA FROM PERSONEL PERS ' +
                     'WHERE ISNULL(PERS.PASIF,0)=0 AND PERS.KULLADI='+QuotedStr(Pers),1);
           if  sDBF.TMP_.RecordCount<>1  then
               begin
                 Response.Content := sdbf.JSonHata(802, 'Kullanıcı Hatalı [1]', '');
                 Response.StatusCode := 401; // Unauthorized
                 Response.SendResponse;
                 exit;
               end;
           .....

Hangi REST framework'ünü kullanıyorsunuz?
Framework ?