hs.http
Perform HTTP requests
API Overview
- Variables - Configurable values
- Functions - API calls offered directly by the extension
API Documentation
Variables
htmlEntities
| Signature | hs.http.htmlEntities[] |
|---|---|
| Type | Variable |
| Description |
A collection of common HTML Entities (&whatever;) and their UTF8 equivalents. To retrieve the UTF8 sequence for a given entity, reference the table as |
| Notes |
|
| Source | extensions/http/http.lua line 144 |
Functions
asyncGet
| Signature | hs.http.asyncGet(url, headers, callback) |
|---|---|
| Type | Function |
| Description |
Sends an HTTP GET request asynchronously |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/http/http.lua line 76 |
asyncPost
| Signature | hs.http.asyncPost(url, data, headers, callback) |
|---|---|
| Type | Function |
| Description |
Sends an HTTP POST request asynchronously |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/http/http.lua line 98 |
asyncPut
| Signature | hs.http.asyncPut(url, data, headers, callback) |
|---|---|
| Type | Function |
| Description |
Sends an HTTP PUT request asynchronously |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/http/http.lua line 121 |
convertHtmlEntities
| Signature | hs.http.convertHtmlEntities(inString) -> outString |
|---|---|
| Type | Function |
| Description |
Convert all recognized HTML Entities in the |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/http/http.lua line 444 |
doAsyncRequest
| Signature | hs.http.doAsyncRequest(url, method, data, headers, callback, [cachePolicy|enableRedirect]) |
|---|---|
| Type | Function |
| Description |
Creates an HTTP request and executes it asynchronously |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/http/libhttp.m line 201 |
doRequest
| Signature | hs.http.doRequest(url, method, [data, headers, cachePolicy]) -> int, string, table |
|---|---|
| Type | Function |
| Description |
Creates an HTTP request and executes it synchronously |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/http/libhttp.m line 264 |
encodeForQuery
| Signature | hs.http.encodeForQuery(string) -> string |
|---|---|
| Type | Function |
| Description |
Returns a copy of the provided string in which characters that are not valid within an HTTP query key or value are escaped with their %## equivalent. |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/http/http.lua line 461 |
get
| Signature | hs.http.get(url, headers) -> int, string, table |
|---|---|
| Type | Function |
| Description |
Sends an HTTP GET request to a URL |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/http/http.lua line 11 |
post
| Signature | hs.http.post(url, data, headers) -> int, string, table |
|---|---|
| Type | Function |
| Description |
Sends an HTTP POST request to a URL |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/http/http.lua line 32 |
put
| Signature | hs.http.put(url, data, headers) -> int, string, table |
|---|---|
| Type | Function |
| Description |
Sends an HTTP PUT request to a URL |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/http/http.lua line 54 |
registerEntity
| Signature | hs.http.registerEntity(entity, codepoint) -> string |
|---|---|
| Type | Function |
| Description |
Registers an HTML Entity with the specified Unicode codepoint which can later referenced in your code as |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/http/http.lua line 419 |
urlParts
| Signature | hs.http.urlParts(url) -> table |
|---|---|
| Type | Function |
| Description |
Returns a table of keys containing the individual components of the provided url. |
| Parameters |
|
| Returns |
|
| Notes |
|
| Source | extensions/http/libhttp.m line 332 |
© 2014–2017 Hammerspoon contributors
Licensed under the MIT License.
https://www.hammerspoon.org/docs/hs.http.html