HTTP Request unintended behavior

Hi there,

I am having an issue with the HTTP request activity using UiPath.WebAPI.activities 2.3.2. (UiPath.Web.Activities.Http.NetHttpRequest)
It seems that when calling an endpoint that returns an image, the image is automatically saved to disk even when Always save response as file is False.

The steps to recreate this behavior are really easy. Just open Studio, create a brand new process, add the HTTP request activity, put “https://picsum.photos/id/237/200/300” as the URL, then verify in the properties panel that Always save response as file defaults to false just for your own sanity.
image
Then just run/debug the file or process and note that an image 237-200x300 will be saved in the project directory whether you want it to or not.

This seems to be an unintentional bug right? You can very clearly see that the file was saved to disk even when ‘SaveResponseAsFile’ shows false in the RawRequestDebuggingInfo when debugging and logging.

@hivesew

a small clarity here…saveResponseAsFile is used to force save the response to file even if it is not a file type

but if it is a file response that we get from request then it would default save the file whatever the saveResponseAsFile property value is

cheers

Hi @hivesew

This issue is a known UiPath bug where SaveResponseAsFile writes the response to disk even when disabled. To avoid this, don’t use the HTTP Request activity for image validation.

Instead, use an Invoke Code or Invoke Method activity to download the response into memory, check if the data is actually an image, and only then save it manually. This prevents unwanted file creation.

I can confirm that @Anil_G’s reply is correct. The activity is built to automatically save obvious files to the hard drive (by default, when ‘always save response as file’ is set to false).

If set up like that, responses such as application/json will not be saved to a file, though.

This is why we introduced this setting. It forces the save if, for example, you want to save JSON payloads to a file.


In terms of your options here, simply use the Delete file activity to delete the downloaded file afterward to keep things clean.

1 Like