forked from dart-lang/shelf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request dart-lang#19 from jonasfj/test-unrelated-annotation
Test that unrelated annotations does not affect code-gen
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
pkgs/shelf_router_generator/test/server/unrelatedannotation.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/// Annotation for an API end-point. | ||
class EndPoint { | ||
/// HTTP verb for requests routed to the annotated method. | ||
final String verb; | ||
|
||
/// HTTP route for request routed to the annotated method. | ||
final String route; | ||
|
||
/// Create an annotation that routes requests matching [verb] and [route] to | ||
/// the annotated method. | ||
const EndPoint(this.verb, this.route); | ||
|
||
/// Route `GET` requests matching [route] to annotated method. | ||
const EndPoint.get(this.route) : verb = 'GET'; | ||
|
||
/// Route `HEAD` requests matching [route] to annotated method. | ||
const EndPoint.head(this.route) : verb = 'HEAD'; | ||
|
||
/// Route `POST` requests matching [route] to annotated method. | ||
const EndPoint.post(this.route) : verb = 'POST'; | ||
|
||
/// Route `PUT` requests matching [route] to annotated method. | ||
const EndPoint.put(this.route) : verb = 'PUT'; | ||
|
||
/// Route `DELETE` requests matching [route] to annotated method. | ||
const EndPoint.delete(this.route) : verb = 'DELETE'; | ||
|
||
/// Route `CONNECT` requests matching [route] to annotated method. | ||
const EndPoint.connect(this.route) : verb = 'CONNECT'; | ||
|
||
/// Route `OPTIONS` requests matching [route] to annotated method. | ||
const EndPoint.options(this.route) : verb = 'OPTIONS'; | ||
|
||
/// Route `TRACE` requests matching [route] to annotated method. | ||
const EndPoint.trace(this.route) : verb = 'TRACE'; | ||
} |