|
1 | | -# $httpRequest |
2 | | - |
3 | | -Perform an http request, with a content and headers and return the response content |
4 | | - |
5 | | -## Usage |
6 | | - |
7 | | -```bash |
8 | | -$httpRequest[URL;Method;Content;Header 1;Header 2;...] |
9 | | -``` |
10 | | - |
11 | | -### Methods: |
12 | | -Accepts PUT, GET, POST, DELETE, HEAD, PATCH methods, if not provided, it will use GET method |
13 | | - |
14 | | -### Content Input: |
15 | | -It can any content that suitable for your `content-type` header, like with `content-type: application/json` you can put the content as json format and so on |
16 | | - |
17 | | -### Header: |
18 | | -It accept the header in format of header: value\ |
19 | | -for example: `Content-Type: application/json` |
20 | | - |
21 | | -### Example (Sending JSON Request): |
22 | | -<discord-messages> |
23 | | - <discord-message :bot="false" role-color="#ffcc9a" author="Member"> |
24 | | - !!exec $let[response;$httpRequest[My API URL;post;{"name":"Mido"};Content-Type: application/json]]<br>Response is $response<br>Response Status is $httpRequestStatus<br><br> |
25 | | - </discord-message> |
26 | | - <discord-message :bot="true" role-color="#0099ff" author="Custom Command" avatar="https://media.discordapp.net/avatars/725721249652670555/781224f90c3b841ba5b40678e032f74a.webp"> |
27 | | - Response is {"success":true}<br>Response Status is 200<br><br> |
28 | | - </discord-message> |
29 | | -</discord-messages> |
30 | | - |
31 | | -### Some Notes: |
32 | | -* This function wont throw error if request non-ok status, so please check on your own the return value of $httpRequestStatus after the request to make sure its valid status you expecting |
| 1 | +# $httpRequest |
| 2 | + |
| 3 | +Perform an http request, with a content and headers and return the response content |
| 4 | + |
| 5 | +## Usage |
| 6 | + |
| 7 | +```bash |
| 8 | +$httpRequest[URL;Method;Content;Header 1;Header 2;...] |
| 9 | +``` |
| 10 | + |
| 11 | +### Methods: |
| 12 | +Accepts PUT, GET, POST, DELETE, HEAD, PATCH methods, if not provided, it will use GET method |
| 13 | + |
| 14 | +### Content Input: |
| 15 | +It can any content that suitable for your `content-type` header, like with `content-type: application/json` you can put the content as json format and so on |
| 16 | + |
| 17 | +### Header: |
| 18 | +It accept the header in format of header: value\ |
| 19 | +for example: `Content-Type: application/json` |
| 20 | + |
| 21 | +### Example (Sending JSON Request): |
| 22 | +<discord-messages> |
| 23 | + <discord-message :bot="false" role-color="#ffcc9a" author="Member"> |
| 24 | + !!exec $let[response;$httpRequest[My API URL;post;{"name":"Mido"};Content-Type: application/json]]<br>Response is $response<br>Response Status is $httpRequestStatus<br><br> |
| 25 | + </discord-message> |
| 26 | + <discord-message :bot="true" role-color="#0099ff" author="Custom Command" avatar="https://media.discordapp.net/avatars/725721249652670555/781224f90c3b841ba5b40678e032f74a.webp"> |
| 27 | + Response is {"success":true}<br>Response Status is 200<br><br> |
| 28 | + </discord-message> |
| 29 | +</discord-messages> |
| 30 | + |
| 31 | +### Some Notes: |
| 32 | +* This function wont throw error if request non-ok status, so please check on your own the return value of $httpRequestStatus after the request to make sure its valid status you expecting |
33 | 33 | * Make sure the response data length is less than 1 MB, or it will errorRandom |
0 commit comments