Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TIdHttp no ResponseContent on bad request
#2
(09-14-2021, 07:33 PM)fpctuxe Wrote: with the TIdHTTP i has problems on Rest- Server. Sends the Server on Bad Request (400, 404) the Client doesn’t received the ResponseContent.

Yes, it does, just not where you are expecting it to be.

By default, TIdHTTP raises an EIdHTTPProtocolException for any HTTP error, where the response content will be in the EIdHTTPProtocolException.ErrorMessage property.

As you have already noted, you can enable the hoNoProtocolErrorException option to avoid this exception. There is also a hoWantProtocolErrorContent option available, which you seem to have missed (see https://www.indyproject.org/2016/01/10/n...ved-event/).

(09-14-2021, 07:33 PM)fpctuxe Wrote: I look and found a little workaround. 

That workaround is not necessary, and I will not be incorporating something like that into the main code. The same effect can be achieved by simply enabling the hoNoProtocolErrorException and hoWantProtocolErrorContent options together. No need to modify ProcessResponse() at all.

(09-14-2021, 07:33 PM)fpctuxe Wrote: When will the new Indy library be added to the Lazarus library.

Indy has been available in Lazarus' Online Package Manager for awhile, and is kept up-to-date with GIT updates.

Reply


Messages In This Thread
RE: TIdHttp no ResponseContent on bad request - by rlebeau - 09-14-2021, 08:16 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)