Skip to content

Commit b7c7c17

Browse files
committed
document SMODS.https
1 parent 67ffa2c commit b7c7c17

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

SMODS.https.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# API Documentation: `SMODS.https`
2+
3+
The SMODS.https module is a module designed to be compatible with the [lua-https](https://love2d.org/wiki/lua-https) module. The main difference between this and the built in https module is that `SMODS.https` works on more platforms out of the box, compared to Balatro's shipped https modules (which is only availible on Windows by default).
4+
5+
## Usage
6+
7+
To use this module you must first `require` it, like so:
8+
9+
```lua
10+
local https = require "SMODS.https"
11+
```
12+
13+
## API Methods
14+
15+
- `https.request(url, options) -> code, body, headers`
16+
- `url`: The URL to request.
17+
- `options`: Additional optional options for the request.
18+
- `headers`: Additional headers to add to the request as key-value pairs.
19+
- `method` (One of `"GET"|"POST"|"HEAD"|"PUT"|"DELETE"|"PATCH"`): HTTP method. If absent, it's either "GET" or "POST" depending on the data field.
20+
- `data`: Optional additional data to send as application/x-www-form-urlencoded (unless specified otherwise in Content-Type header).
21+
- Return values:
22+
- `code`: HTTP status code, or 0 on failure.
23+
- `body`: The response body on success. Either nil or a description of the error on failure.
24+
- `headers`: HTTP response headers as key-value pairs, or nil on failure.
25+
26+
## Example Usage
27+
28+
```lua
29+
local https = require "SMODS.https"
30+
31+
print(https.request("https://example.com"))
32+
```
33+

_Sidebar.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Game Objects
1515
* [SMODS.Voucher](https://github.com/Steamodded/smods/wiki/SMODS.Voucher)
1616
* [SMODS.Challenge](https://github.com/Steamodded/smods/wiki/SMODS.Challenge)
1717
* [SMODS.DeckSkin](https://github.com/Steamodded/smods/wiki/SMODS.DeckSkin)
18+
* [SMODS.https](https://github.com/Steamodded/smods/wiki/SMODS.https)
1819
* [SMODS.Keybind](https://github.com/Steamodded/smods/wiki/SMODS.Keybind)
1920
* [SMODS.Language](https://github.com/Steamodded/smods/wiki/SMODS.Language)
2021
* [SMODS.ObjectType](https://github.com/Steamodded/smods/wiki/SMODS.ObjectType)

0 commit comments

Comments
 (0)