Bug introduced in 11.0 and persists through 11.3

The original problem is was fixed in V11.2 but since then it returns File[path/to/file/that/does/not/exits] instead of 401 Failure/HTTPResponse like URLRead does.

CASE:3877019 - confirmed

The second one prompts the dialog:

URLRead["https://httpbin.org/status/401", Interactive -> False]


URLDownload["https://httpbin.org/status/401", Interactive -> False]


but both should return 401 HTTPResponse since

URLDownload takes the options as URLRead.

Interactive - True - whether to allow interactive authentication dialogs

Have I missed something? Is there a workaround?

It probably can be narrowed to URLSave broken for "DisplayProxyDialog" -> False, but this is undocumented so I can't complain.

related:

How to omit the authentification dialog during URLRead?

Inconsistent Authorization Dialog (401) handling

• Interestingly enough, there is a symbol URLUtilitiesPackageScope\$options, setting which with association <|Interactive -> False|> works for URLRead (you can call it without parameters now and it won't show a dialog), but it doesn't for URLDownload – Stitch Apr 12 '17 at 15:43

Before it is fixed one can use this quick workaround based on How to get StatusCode without fetching Body/Content in the background:

DialoglessURLDownload =  URLFetch[
#, "StatusCode", Method -> "HEAD", "DisplayProxyDialog" -> False

I've decided I will return the status code for any case that isn't 200, that is arguable but URLDownload itself gives non existing File[...] when it fails so I will not try to mimic wrong behavior. This at least gives you a possibility to react appropriately.
DialoglessURLDownload @ "https://httpbin.org/status/401"