Improve redbean fetch() (#460)

* Updated Fetch to return `nil,error` on errors
* Fix localhost connect when only IP address is specified
This commit is contained in:
Paul Kulchenko 2022-07-08 07:13:51 -07:00 committed by GitHub
parent 853b6c3864
commit 059fe22ea3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 42 deletions

View file

@ -722,7 +722,8 @@ FUNCTIONS
This function is not available in unsecure mode.
Fetch(url:str[,body:str|{method=value:str,body=value:str,headers=table,...}])
→ status:int,{header:str=value:str,...},body:str
├─→ status:int, {header:str=value:str,...}, body:str
└─→ nil, error:str
Sends an HTTP/HTTPS request to the specified URL. If only the URL is
provided, then a GET request is sent. If both URL and body parameters
are specified, then a POST request is sent. If any other method needs