treeform/puppy

response code is `0` when `401 Unauthorized` with `macOS`

fukusuket opened this issue · 0 comments

Thank you for maintaining tool :)
I am reporting an issue because there is case where the response code did not give the intended result.

Describe the issue
Response code is 0 when 401 Unauthorized with macOS.

Step to Reproduce
Execute following code.

import puppy

let response = get("https://httpbin.org/basic-auth/testuser/testpassword")
echo response.code

Expected behavior
The output result is 401

Actual behavior
The output result is 0

Environment

  • OS: macOS Ventura 13.5.2
  • Puppy version 2.1.0
  • Nim version 2.0.0

Additional context
The output of curl is as follows.

% curl -I "https://httpbin.org/basic-auth/testuser/testpassword"
HTTP/2 401
date: Sun, 17 Sep 2023 12:31:01 GMT
content-length: 0
server: gunicorn/19.9.0
www-authenticate: Basic realm="Fake Realm"
access-control-allow-origin: *
access-control-allow-credentials: true

On Ubuntu 22.04, the same code returned 401, so it seems to be a macOS-only issue.