mirror of
https://codeberg.org/reflect/reflect-rules-plugin.git
synced 2025-09-13 16:33:42 +02:00
doc(fix): use a POST request as the example in the README instread of GET (#14)
The example sends a request body to a GET request, and [GET requests can not have a request body](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/GET). So this PR changes the example to a POST request instead. Reviewed-on: https://codeberg.org/reflect/reflect-rules-plugin/pulls/14 Co-authored-by: vlw <victor@vlw.se> Co-committed-by: vlw <victor@vlw.se>
This commit is contained in:
parent
9c837fd194
commit
24352ae45b
1 changed files with 3 additions and 3 deletions
|
@ -3,9 +3,9 @@ This request pre-processor adds request validation for an API written in the Ref
|
|||
|
||||
Write safer Reflect endpoints by enforcing request data structure validation before the request reaches your endpoint's logic. This plugin validates GET and POST data (even JSON) and returns an array with scoped `Error`s that can be further acted upon if desired.
|
||||
|
||||
*Example:*
|
||||
## Example
|
||||
```
|
||||
GET Request: /my-endpoint?key1=lorem-ipsum&key2=dolor
|
||||
POST Request: /my-endpoint?key1=lorem-ipsum&key2=dolor
|
||||
POST Body: {"key3":15, "key4":["hello", "world"]}
|
||||
```
|
||||
```php
|
||||
|
@ -16,7 +16,7 @@ use \ReflectRules\Type;
|
|||
use \ReflectRules\Rules;
|
||||
use \ReflectRules\Ruleset;
|
||||
|
||||
class GET_MyEndpoint implements Endpoint {
|
||||
class POST_MyEndpoint implements Endpoint {
|
||||
private Ruleset $rules;
|
||||
|
||||
public function __construct() {
|
||||
|
|
Loading…
Add table
Reference in a new issue