forked from timfel/ratpack
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
53 additions
and
8 deletions.
There are no files selected for viewing
Empty file.
4 changes: 4 additions & 0 deletions
4
packages/RatPack.package/RPAntiPreHookConventionMiddleware.class/instance/preHook..st
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,4 @@ | ||
interaction | ||
preHook: anEnv | ||
|
||
^ self |
5 changes: 5 additions & 0 deletions
5
packages/RatPack.package/RPAntiPreHookConventionMiddleware.class/methodProperties.json
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,5 @@ | ||
{ | ||
"class" : { | ||
}, | ||
"instance" : { | ||
"preHook:" : "lj 7/4/2018 12:26" } } |
14 changes: 14 additions & 0 deletions
14
packages/RatPack.package/RPAntiPreHookConventionMiddleware.class/properties.json
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,14 @@ | ||
{ | ||
"category" : "RatPack-Testing", | ||
"classinstvars" : [ | ||
], | ||
"classvars" : [ | ||
], | ||
"commentStamp" : "", | ||
"instvars" : [ | ||
], | ||
"name" : "RPAntiPreHookConventionMiddleware", | ||
"pools" : [ | ||
], | ||
"super" : "RPTestMiddleware", | ||
"type" : "normal" } |
6 changes: 6 additions & 0 deletions
6
packages/RatPack.package/RPMiddleware.class/instance/assertedPreHookResult..st
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,6 @@ | ||
interaction | ||
assertedPreHookResult: aPreHookResult | ||
|
||
((aPreHookResult respondsTo: #ifTrue:) and: [ (aPreHookResult respondsTo: #ifFalse:). ]) | ||
ifTrue: [ ^ aPreHookResult ] | ||
ifFalse: [ self error: 'preHook of: ' , self name , ' has to return true or false.' ] |
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
4 changes: 3 additions & 1 deletion
4
packages/RatPack.package/RPMiddleware.class/instance/postHook..st
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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
interaction | ||
postHook: anEnv | ||
postHook: anEnv | ||
|
||
"Called after handler execution" |
6 changes: 5 additions & 1 deletion
6
packages/RatPack.package/RPMiddleware.class/instance/preHook..st
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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
interaction | ||
preHook: anEnv | ||
|
||
" return true if you want to continue handling this request. Return false if the handling should be aborted." | ||
"Called before handler execution. Return value must understand #ifTrue: or #ifFalse: | ||
Return true if you want to continue handling this request. | ||
Return false if the handling should be aborted. (Post Hook is not called.)" | ||
|
||
^ true |
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
8 changes: 8 additions & 0 deletions
8
packages/RatPack.package/RPTests.class/instance/testMiddlewarePreHookConvention.st
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,8 @@ | ||
test - database - postgresql | ||
testMiddlewarePreHookConvention | ||
|
||
| middleware | | ||
middleware := RPAntiPreHookConventionMiddleware new. | ||
self assert: (middleware assertedPreHookResult: true) equals: true. | ||
self assert: (middleware assertedPreHookResult: false) equals: false. | ||
self assert: ([middleware assertedPreHookResult: (middleware preHook: nil). false] on: Error do: [true]) |
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