pawn-requests provides an API for interacting with HTTP(S) JSON APIs.
Fixes a bug with Request
randomly failing due to uninitialised memory. Thanks to @ziggi for the fix!
Fixed a bug that caused callbacks to duplicate when multiple AMX instances were present (such as Filterscripts).
Rebuilt with the latest version of cpprestsdk - this fixes #17
Added a missing const
, thanks @AGraber!
Fixed some minor bugs with garbage collection. Using JsonToggleGC
would be ineffective if JsonGet*
functions were used on a node.
Fixed content type not being set on JSON requests with no body.
RequestJSON
with POST
will now correctly set Content-Type: application/json
even if no JSON body is set.
Fixed return values for missing keys on JsonGet*
functions. Calling JsonGet*
with a key that does not exist will now return a non-zero error code. This release also removes the ERROR:
prints caused by doing this.
Implemented JsonSet*
functions for directly assigning keys to values. This can be used as an alternative to the Json*
object builder API for explicitly setting keys to values of all types. This combined with JsonToggleGC
means JSON objects can be modified across function calls and via callbacks.
Example:
new Node:n = JsonObject();
JsonToggleGC(n, false);
mutateJson(n);
JsonToggleGC(n, true);```
// n now contains key1 and key2
// in another part of code
mutateJson(Node:n) {
JsonSetString(n, "key1", "value1");
JsonSetObject(n, "key2", JsonObject(
"key3", JsonString("value2")
));
}