Bug 22142 – Improve error reporting for std.curl.net

Status
NEW
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2021-07-25T15:37:27Z
Last change time
2024-12-01T16:39:04Z
Assigned to
No Owner
Creator
Lance Bachmeier
Moved to GitHub: phobos#9826 →

Comments

Comment #0 by lance — 2021-07-25T15:37:27Z
std.net.curl doesn't provide information when something fails. Consider the following (not terribly obvious) typo: client.addRequestHeader("Content-Type", "Application/json"); followed by a call to post: post("https://api.todoist.com/rest/v1/tasks", cmd, client); You get only a generic error message: HTTP request returned status code 400 () Compare this with the error message if you do the same thing with command line curl. The message is: Empty content That immediately points you in the right direction. What is the typo? The line at the beginning should be client.addRequestHeader("Content-Type", "application/json"); "Status code 400" does not help. "Empty content" does.
Comment #1 by robert.schadek — 2024-12-01T16:39:04Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/9826 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB