briast
briast

Reputation: 317

idHTTP Post raise exception cannot open file

When I call idHTTP.Post( cUrlPath + '/user/logout.json','') to logout from a WebService, I always get an exception:

cannot open file ""

All other idHTTP.Post requests work good (log in, create, etc).

I have added a try-except block to manage this issue, but I would like to know why it happens, and what I can do to avoid it.

Upvotes: 0

Views: 571

Answers (1)

Remy Lebeau
Remy Lebeau

Reputation: 596557

The code you have shown is calling Post() with only a URL and no data to send to the server. There is NO overloaded version of Post() that accepts only 1 parameter as input, ALL OF THEM take 2 or more parameters. So clearly you are not showing your real code.

The only way I can see this error happening is if you are calling one of the overloaded versions of Post() that has an ASourceFile parameter, and you are setting that parameter to an empty string, eg

idHTTP.Post(cUrlPath + '/user/logout.json', '')

That would cause a cannot open file "" exception.

Upvotes: 1

Related Questions