timschumi / gmod-chttp-utils

Wrapper functions and helpers for CHTTP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

chttp-utils

This plugin is available on the Steam Workshop.

This is a support library that provides additional functions and wrappers for my HTTP library, CHTTP.

Please note that installing the CHTTP module is still required.

If you like my work or otherwise profited from this addon, consider buying me a beer!

Usage

chttp-utils isn't a normal module due to naming conflicts with the actual binary module. Instead, it is a normal LUA file that should be included.

-- Set this if you don't want to print any error messages when the module fails to load
-- (for example if you have your own messages or if you have fallback options).
CHTTP_SILENT = true

-- This will provide a global `chttp` table providing all the functions.
-- The table will not be present if the module fails to load.
include("chttp.lua")

The following functions will be available:

-- Behaves just like http.Fetch (https://wiki.facepunch.com/gmod/http.Fetch)
chttp.Fetch(url, onSuccess, onFailure, headers)

-- Behaves just like http.Post (https://wiki.facepunch.com/gmod/http.Post)
chttp.Post(url, parameters, onSuccess, onFailure, headers)

About

Wrapper functions and helpers for CHTTP

License:MIT License


Languages

Language:Lua 100.0%