Difference between revisions of "Http.get"

From MiniScript Wiki
Jump to navigation Jump to search
(Created page with "In Mini Micro, the http.get function returns the contents of a URL using the HTTP protocol. It supports text, images, sounds, and raw binary data. === Arguments ===...")
 
(added new headers parameter)
Line 8: Line 8:
 
|-
 
|-
 
| url || URL of the web page or resource to fetch
 
| url || URL of the web page or resource to fetch
 +
|-
 +
| headers || optional map of HTTP headers
 
|}
 
|}
  

Revision as of 04:07, 24 September 2020

In Mini Micro, the http.get function returns the contents of a URL using the HTTP protocol. It supports text, images, sounds, and raw binary data.

Arguments

Parameter Name Meaning
url URL of the web page or resource to fetch
headers optional map of HTTP headers

Usage Notes

The type of the value returned depends on the MIME type reported by the server, as follows:

MIME Type MiniScript Type
image Image object
audio Sound object
text, javascript, xml, or json string
any other type RawData object

Example

The following example, typed on the Mini Micro command line, retrieves and displays Minnie from the MiniScript web site.

view http.get("https://miniscript.org/img/Icon.png")