treeform / puppy

Puppy fetches via HTTP and HTTPS
MIT License
184 stars 27 forks source link

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

Open fukusuket opened 9 months ago

fukusuket commented 9 months ago

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

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.