Frederick Posted July 27, 2022 Share Posted July 27, 2022 I have two gateways that calls my app for callback reasons. One of them expects a "200" response and the other needs the "OK" response. In UniServerModule's OnHttpCommand event, I added the following code:- AResponseInfo.ContentText:='OK'; AResponseInfo.ContentType := 'text/plain'; AResponseInfo.ResponseNo:=200; When I run the application, I get an "Ajax Error: OK is not defined" all the time. What am I missing here and is my above code correct in returning the responses to the gateways? -- Frederick (UniGUI Complete - Professional Edition 1.90.0.1562) Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 27, 2022 Share Posted July 27, 2022 32 minutes ago, Frederick said: When I run the application, I get an "Ajax Error: OK is not defined" all the time. Hello, Handled := True; ? Quote Link to comment Share on other sites More sharing options...
Frederick Posted July 27, 2022 Author Share Posted July 27, 2022 I can't use "Handled:=True" because the app just returns "OK" and stops. I want the app to respond to the calling gateways and then proceed to the login screen. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 27, 2022 Share Posted July 27, 2022 Sorry, I don't understand your case. Please explain in more detail... Quote Link to comment Share on other sites More sharing options...
Frederick Posted July 27, 2022 Author Share Posted July 27, 2022 My app has one login form. Normally, when I call the app from the browser, the login form appears. If I put the following code in UniServerModule's OnHttpCommand event, the browser displays an "OK" and then stops. The login form does not show. AResponseInfo.ContentText:='OK'; AResponseInfo.ContentType := 'text/plain'; AResponseInfo.ResponseNo:=200; Handled:=True; How do get my app to return the response code of "OK" to my browser AND show the login form? Quote Link to comment Share on other sites More sharing options...
irigsoft Posted July 27, 2022 Share Posted July 27, 2022 1 hour ago, Frederick said: My app has one login form. Normally, when I call the app from the browser, the login form appears. If I put the following code in UniServerModule's OnHttpCommand event, the browser displays an "OK" and then stops. The login form does not show. AResponseInfo.ContentText:='OK'; AResponseInfo.ContentType := 'text/plain'; AResponseInfo.ResponseNo:=200; Handled:=True; How do get my app to return the response code of "OK" to my browser AND show the login form? @Frederickhello, try this: UniServerModule's OnHttpCommand var oldContent : String; begin inherited; oldContent := AResponseInfo.ContentText; AResponseInfo.ContentText := 'OK'; AResponseInfo.ContentType := 'text/plain'; AResponseInfo.ResponseNo := 200; Handled := True; sleep (2000);//add a 2 second delay to get the first response (but may not be necessary) AResponseInfo.ContentText := oldContent; Handled := False; end; you can try this in UniGUIServerModuleHTTPDocument too. Quote Link to comment Share on other sites More sharing options...
Frederick Posted July 27, 2022 Author Share Posted July 27, 2022 Thanks for the code. This seems to work. What advantage is there in using this code in UniGUIServerModuleHTTPDocument compared with in UniGUIServerModuleHTTPCommand? Quote Link to comment Share on other sites More sharing options...
irigsoft Posted July 27, 2022 Share Posted July 27, 2022 20 minutes ago, Frederick said: Thanks for the code. This seems to work. What advantage is there in using this code in UniGUIServerModuleHTTPDocument compared with in UniGUIServerModuleHTTPCommand? nothing important, you can just try to return OK (200) when the document is filled not on every request. Quote Link to comment Share on other sites More sharing options...
Frederick Posted July 27, 2022 Author Share Posted July 27, 2022 Noted. Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.