Http.get
Jump to navigation
Jump to search
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
When specifying headers, certain headers are supplied by the underlying system and may not be overridden. These include "Host" and "Accept". Specifying these headers will cause http.get
to return a null result.
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")