forked from sqlpage/SQLPage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path43_request_method.sql
34 lines (29 loc) · 1.21 KB
/
43_request_method.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
INSERT INTO
sqlpage_functions (
"name",
"introduced_in_version",
"icon",
"description_md"
)
VALUES
(
'request_method',
'0.21.0',
'http-get',
'Returns the HTTP request method (GET, POST, etc.) used to access the page.
# HTTP request methods
HTTP request methods (also known as verbs) are used to indicate the desired action to be performed on the identified resource. The most common methods are:
- **GET**: retrieve information from the server. This is the default method used by browsers when you click on a link.
- **POST**: submit data to be processed by the server. This is the default method used by browsers when you submit a form.
- **PUT**: replace the current representation of the target resource with the request payload. Most commonly used in REST APIs.
- **DELETE**: remove the target resource.
- **PATCH**, **HEAD**, **OPTIONS**, **CONNECT**, **TRACE**: less common methods that are used in specific situations.
# Example
```sql
select ''redirect'' as component,
''/error?msg=expected+a+PUT+request'' as link,
where sqlpage.request_method() != ''PUT'';
insert into my_table (column1, column2) values (:value1, :value2);
```
'
);