[IDEA] --write-out print body on http error code
Bastian Jesuiter via curl-users <[email protected]>
| Newsgroups | gmane.comp.web.curl.general |
|---|---|
| Message-ID | <CAL07qPWdcYTjMsc7WaDzXQ+MMzRRB+hw81bLzS57kYXUsc2C5A@mail.gmail.com> |
Hi, Would it be possible to add a --write-out variable, to allow printing of the body, In case the http code is an error (not 20* status code) ? For example, I provide a curl command for other users to download a file, which may be available, or in some cases not available due to a scan which may block the request temporarily. Thus, since it is supposed to be a file, the command uses -o to write the output to a file. When the status code is an error it either writes the request body (the error) to the specified file, unless --fail is used. But if --fail is used, no body is printed into neither the file nor stdout. In a lot of cases, servers (like Artifactory) usually respond with some kind of error message in the return, which may be helpful to know to the person using the command. Using write-out to optionally print the body if an error occured seems useful in this case. Sure it could print the status code along a custom message, but the specific error from the body may be more helpful than a static error message I can write. I'm not sure how much work it would be, thus this is just a small idea for potential improvement. Thanks, Bastian -- Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-users Etiquette: https://curl.se/mail/etiquette.html