Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robrwo/catalyst-traitfor-request-methods-
Add enumerated methods for HTTP requests
https://github.com/robrwo/catalyst-traitfor-request-methods-
catalyst http perl
Last synced: 17 days ago
JSON representation
Add enumerated methods for HTTP requests
- Host: GitHub
- URL: https://github.com/robrwo/catalyst-traitfor-request-methods-
- Owner: robrwo
- Created: 2019-08-12T08:41:45.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-06-14T14:37:57.000Z (over 1 year ago)
- Last Synced: 2024-11-06T09:23:52.352Z (2 months ago)
- Topics: catalyst, http, perl
- Language: Perl
- Size: 60.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
Awesome Lists containing this project
README
# NAME
Catalyst::TraitFor::Request::Methods - Add enumerated methods for HTTP requests
# VERSION
version v0.5.2
# SYNOPSIS
In the [Catalyst](https://metacpan.org/pod/Catalyst) class
```perl
__PACKAGE__->config(
request_class_traits => [
'Methods'
]
);
```In any code that uses a [Catalyst::Request](https://metacpan.org/pod/Catalyst%3A%3ARequest), e.g.
```
if ($c->request->is_post) {
...
}
```# DESCRIPTION
This trait adds enumerated methods from RFC 7231 and RFC 5789 for
checking the HTTP request method.Using these methods is a less error-prone alternative to checking a
case-sensitive string with the method name.In other words, you can use
```
$c->request->is_get
```instead of
```
$c->request->method eq "GET"
```The methods are implemented as lazy read-only attributes.
# METHODS
## is\_get
The request method is `GET`.
## is\_head
The request method is `HEAD`.
## is\_post
The request method is `POST`.
## is\_put
The request method is `PUT`.
## is\_delete
The request method is `DELETE`.
## is\_connect
The request method is `CONNECT`.
## is\_options
The request method is `OPTIONS`.
## is\_trace
The request method is `TRACE`.
## is\_patch
The request method is `PATCH`.
## is\_unrecognized\_method
The request method is not recognized.
# SUPPORT FOR OLDER PERL VERSIONS
This module requires Perl v5.14 or later.
Future releases may only support Perl versions released in the last ten years.
# SEE ALSO
[Catalyst::Request](https://metacpan.org/pod/Catalyst%3A%3ARequest)
# SOURCE
The development version is on github at [https://github.com/robrwo/Catalyst-TraitFor-Request-Methods-](https://github.com/robrwo/Catalyst-TraitFor-Request-Methods-)
and may be cloned from [git://github.com/robrwo/Catalyst-TraitFor-Request-Methods-.git](git://github.com/robrwo/Catalyst-TraitFor-Request-Methods-.git)# BUGS
Please report any bugs or feature requests on the bugtracker website
[https://github.com/robrwo/Catalyst-TraitFor-Request-Methods-/issues](https://github.com/robrwo/Catalyst-TraitFor-Request-Methods-/issues)When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.# AUTHOR
Robert Rothenberg
# COPYRIGHT AND LICENSE
This software is Copyright (c) 2019-2023 by Robert Rothenberg.
This is free software, licensed under:
```
The Artistic License 2.0 (GPL Compatible)
```